pastebin v0.1.7
error
Feb 4 2012 5:34 PM
hits: 8
Anonymous
Jan 31 2012 4:15 AM
hits: 15
Anonymous
Jan 30 2012 1:29 PM
hits: 13
peliculas de sony
Jan 29 2012 8:35 AM
hits: 35
peliculas de sony
Jan 28 2012 9:52 AM
hits: 37
peliculas de sony
Jan 27 2012 6:39 AM
hits: 33
peliculas de sony
Jan 27 2012 6:38 AM
hits: 21
peliculas de sony
Jan 27 2012 6:38 AM
hits: 20
peliculas de sony
Jan 25 2012 2:16 PM
hits: 51
peliculas de sony
Jan 25 2012 2:15 PM
hits: 31
Anonymous
Jan 25 2012 2:15 PM
hits: 27
peliculas
Jan 25 2012 3:47 AM
hits: 45

Valid HTML 4.01 Strict

Valid CSS!


  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
Imports DigitalScout.App.Data
 
Public Class GameStateRecord
 
    Public inning As Integer
    Public inningTop As Boolean
    Public batterPlayerID As Guid?
    Public batterBats As Integer
    Public battingOrderPosition As Integer
    Public pitcherPlayerID As Guid?
    Public pitcherThrows As Integer
    Public defensePlayerID?(MAX_PBP_DEFENDERS) As Guid
    Public outs As Integer
    Public balls As Integer
    Public strikes As Integer
    Public numberOfPitches As Integer
    Public numberOfStrikes As Integer
    Public nextBatterUp As Integer
    Public homeLineupPlayerID?(MAX_LINEUP_PLAYERS) As Guid
    Public homeLineupPosition?(MAX_LINEUP_PLAYERS) As Integer
    Public homeLastBatterUp As Integer
    Public visitorLineupPlayerID?(MAX_LINEUP_PLAYERS) As Guid
    Public visitorLineupPosition?(MAX_LINEUP_PLAYERS) As Integer
    Public visitorLastBatterUp As Integer
    Public firstBasePlayers?(MAX_PLAYERS_ON_BASE) As Guid
    Public firstBaseEvents?(MAX_PLAYERS_ON_BASE) As Guid
    Public secondBasePlayers?(MAX_PLAYERS_ON_BASE) As Guid
    Public secondBaseEvents?(MAX_PLAYERS_ON_BASE) As Guid
    Public thirdBasePlayers?(MAX_PLAYERS_ON_BASE) As Guid
    Public thirdBaseEvents?(MAX_PLAYERS_ON_BASE) As Guid
 
    Sub GameState_Initialize()
 
        Dim i As Integer
        With Me
            .inning = 1
            .inningTop = True
            .batterPlayerID = Nothing
            For i = 1 To MAX_PBP_DEFENDERS
                .defensePlayerID(i) = Nothing
            Next i
            .outs = 0
            .balls = 0
            .strikes = 0
            '.nextBatterUp = 0
            For i = 1 To MAX_LINEUP_PLAYERS
                .homeLineupPlayerID(i) = Nothing
                .homeLineupPosition(i) = Nothing
                .visitorLineupPlayerID(i) = Nothing
                .visitorLineupPosition(i) = Nothing
            Next i
            .homeLastBatterUp = 0
            .visitorLastBatterUp = 0
            For i = 1 To MAX_PLAYERS_ON_BASE
                .firstBasePlayers(i) = Nothing
                .firstBaseEvents(i) = Nothing
                .secondBasePlayers(i) = Nothing
                .secondBaseEvents(i) = Nothing
                .thirdBasePlayers(i) = Nothing
                .thirdBaseEvents(i) = Nothing
            Next i
        End With
 
    End Sub
 
    Sub GameState_PutRunnerOn(ByVal base As Integer, ByVal playerID As Guid?, ByVal eventID As Guid?)
 
        If base = 1 Then
            BasePlayers_Add(Me.firstBasePlayers, Me.firstBaseEvents, playerID, eventID)
            BasePlayers_Remove(Me.secondBasePlayers, Me.secondBaseEvents, playerID)
            BasePlayers_Remove(Me.thirdBasePlayers, Me.thirdBaseEvents, playerID)
        End If
        If base = 2 Then
            BasePlayers_Remove(Me.firstBasePlayers, Me.firstBaseEvents, playerID)
            BasePlayers_Add(Me.secondBasePlayers, Me.secondBaseEvents, playerID, eventID)
            BasePlayers_Remove(Me.thirdBasePlayers, Me.thirdBaseEvents, playerID)
        End If
        If base = 3 Then
            BasePlayers_Remove(Me.firstBasePlayers, Me.firstBaseEvents, playerID)
            BasePlayers_Remove(Me.secondBasePlayers, Me.secondBaseEvents, playerID)
            BasePlayers_Add(Me.thirdBasePlayers, Me.thirdBaseEvents, playerID, eventID)
        End If
        If base = 4 Then
            BasePlayers_Remove(Me.firstBasePlayers, Me.firstBaseEvents, playerID)
            BasePlayers_Remove(Me.secondBasePlayers, Me.secondBaseEvents, playerID)
            BasePlayers_Remove(Me.thirdBasePlayers, Me.thirdBaseEvents, playerID)
        End If
 
    End Sub
 
    Sub GameState_Get(ByVal contestID As Guid)
 
        Dim g As New Data.Contest
        Dim gPref As New Data.Baseball.ContestPreference
        Dim hLineup As New Data.Baseball.Lineup
        Dim vLineup As New Data.Baseball.Lineup
        Dim hGuid, vGuid As Guid
        Dim i As Integer
        Dim posUpperLimit As Integer
        Dim sql As String
        Dim advanceBatter As Boolean
 
        Try
 
            If BASEBALL_PROGRAM Then
                posUpperLimit = 9
            Else
                posUpperLimit = 11
            End If
            Me.GameState_Initialize()
 
            g.Get(conn, contestID)
            gPref.GetByContestId(conn, contestID)
            Contest.GetHomeAndVisitor(conn, contestID, hGuid, vGuid)
            hLineup.GetByContestAndTeamID(conn, contestID, hGuid)
            vLineup.GetByContestAndTeamID(conn, contestID, vGuid)
 
            ' fill in the lineup arrays
            For i = 1 To MAX_LINEUP_PLAYERS
                Me.homeLineupPlayerID(i) = hLineup.playerID(i - 1)
                Me.homeLineupPosition(i) = hLineup.playerPosition(i - 1)
                Me.visitorLineupPlayerID(i) = vLineup.playerID(i - 1)
                Me.visitorLineupPosition(i) = vLineup.playerPosition(i - 1)
            Next
 
            ' read through the events
            Dim playList As List(Of Guid)
            Dim pl As New Data.Baseball.Play
            playList = SDFDatabase.GuidList(conn, "baseballplays", "playid", "contestid = '" + contestID.ToString + _
                                                "'", "").ToList
 
            For Each pID In playList
                pl.Get(conn, pID)
                advanceBatter = False
                If pl.PlayType = PLAY_TYPE_NEW_INNING Then
                    Me.inning = pl.Inning
                    Me.inningTop = pl.InningTop
                    Me.outs = 0
                    Me.balls = 0
                    Me.strikes = 0
                    BasePlayers_Clear(Me.firstBasePlayers, Me.firstBaseEvents)
                    BasePlayers_Clear(Me.secondBasePlayers, Me.secondBaseEvents)
                    BasePlayers_Clear(Me.thirdBasePlayers, Me.thirdBaseEvents)
                End If
                If pl.PlayType = PLAY_TYPE_CHANGE_GAME_STATE Then
                    Me.inning = pl.Inning
                    Me.inningTop = pl.InningTop
                    Me.outs = Val(Mid(pl.DefensiveSequence, 1, 1))
                    Me.balls = Val(Mid(pl.DefensiveSequence, 2, 1))
                    Me.strikes = Val(Mid(pl.DefensiveSequence, 3, 1))
                    BasePlayers_Clear(Me.firstBasePlayers, Me.firstBaseEvents)
                    If Val(Mid(pl.DefensiveSequence, 4, 1)) <> 0 Then
                        BasePlayers_Add(Me.firstBasePlayers, Me.firstBaseEvents, TEAM_PLAYER_ID, Nothing)
                    End If
                    BasePlayers_Clear(Me.secondBasePlayers, Me.secondBaseEvents)
                    If Val(Mid(pl.DefensiveSequence, 5, 1)) <> 0 Then
                        BasePlayers_Add(Me.secondBasePlayers, Me.secondBaseEvents, TEAM_PLAYER_ID, Nothing)
                    End If
                    BasePlayers_Clear(Me.thirdBasePlayers, Me.thirdBaseEvents)
                    If Val(Mid(pl.DefensiveSequence, 6, 1)) <> 0 Then
                        BasePlayers_Add(Me.thirdBasePlayers, Me.thirdBaseEvents, TEAM_PLAYER_ID, Nothing)
                    End If
                End If
                If pl.PlayType = PLAY_TYPE_PITCH Then
                    If pl.PitchResult = PITCH_RESULT_BALL Or pl.PitchResult = PITCH_RESULT_BALL_CHECK_SWING Or _
                                pl.PitchResult = PITCH_RESULT_INTENTIONAL_BALL Or pl.PitchResult = PITCH_RESULT_PITCHOUT Then
                        Me.balls = Me.balls + 1
                        If Me.balls >= gPref.ballsPerWalk Then
                            Me.balls = 0
                            Me.strikes = 0
                            advanceBatter = True
                        End If
                    End If
                    If pl.PitchResult = PITCH_RESULT_STRIKE_SWINGING Or pl.PitchResult = PITCH_RESULT_STRIKE_CALLED Then
                        Me.strikes = Me.strikes + 1
                        If Me.strikes >= gPref.strikesPerStrikeout And BitIsOff(pl.PitchFlags, PITCH_FLAGS_K_ON_BASE) Then
                            Me.balls = 0
                            Me.strikes = 0
                            Me.outs = Me.outs + 1
                            advanceBatter = True
                        End If
                        If Me.strikes >= gPref.strikesPerStrikeout And BitIsOn(pl.PitchFlags, PITCH_FLAGS_K_ON_BASE) Then
                            Me.balls = 0
                            Me.strikes = 0
                            advanceBatter = True
                        End If
                    End If
                    If pl.PitchResult = PITCH_RESULT_FOUL_BALL Then
                        If Me.strikes < gPref.strikesPerStrikeout - 1 Then
                            Me.strikes = Me.strikes + 1
                        End If
                    End If
                    If pl.PitchResult = PITCH_RESULT_BALL_IN_PLAY Then
                        Me.balls = 0
                        Me.strikes = 0
                        advanceBatter = True
                    End If
                    If pl.PitchResult = PITCH_RESULT_HIT_BY_PITCH Then
                        Me.balls = 0
                        Me.strikes = 0
                        advanceBatter = True
                    End If
                    If Me.inningTop Then
                        Me.visitorLastBatterUp = pl.BattingOrderPosition - 1
                    Else
                        Me.homeLastBatterUp = pl.BattingOrderPosition - 1
                    End If
                End If
                If pl.PlayType = PLAY_TYPE_ON_BASE Then
                    If pl.BallInPlayResult = BALL_IN_PLAY_RESULT_OUT Or pl.BallInPlayResult = BALL_IN_PLAY_RESULT_DP Or _
                            pl.BallInPlayResult = BALL_IN_PLAY_RESULT_SF Or pl.BallInPlayResult = BALL_IN_PLAY_RESULT_SH Then
                        ' out
                        Me.balls = 0
                        Me.strikes = 0
                        Me.outs = Me.outs + 1
                        advanceBatter = True
                    ElseIf pl.BallInPlayResult >= BALL_IN_PLAY_RESULT_HRO Then
                        ' homerun out
                        Me.balls = 0
                        Me.strikes = 0
                        Me.outs = Me.outs + 1
                        advanceBatter = True
                    ElseIf pl.BallInPlayResult >= BALL_IN_PLAY_RESULT_1B And pl.BallInPlayResult <= BALL_IN_PLAY_RESULT_HR Then
                        ' single, double, triple, or homerun
                        Me.balls = 0
                        Me.strikes = 0
                        Me.GameState_PutRunnerOn(pl.BallInPlayResult, pl.PlayerID, pl.PlayID)
                        advanceBatter = True
                    Else
                        If pl.OnBaseResult = ON_BASE_RESULT_OUT Then
                            BasePlayers_Remove(Me.firstBasePlayers, Me.firstBaseEvents, pl.PlayerID)
                            BasePlayers_Remove(Me.secondBasePlayers, Me.secondBaseEvents, pl.PlayerID)
                            BasePlayers_Remove(Me.thirdBasePlayers, Me.thirdBaseEvents, pl.PlayerID)
                            Me.outs = Me.outs + 1
                        ElseIf pl.OnBaseResult = ON_BASE_RESULT_PLACED_ON_FIRST_BASE Then
                            Me.balls = 0
                            Me.strikes = 0
                            Me.GameState_PutRunnerOn(1, pl.PlayerID, pl.PlayID)
                            advanceBatter = True
                        ElseIf BitIsOn(pl.OnBaseFlags, ON_BASE_FLAGS_CATCHERS_INTERFERENCE) Then
                            Me.balls = 0
                            Me.strikes = 0
                            Me.GameState_PutRunnerOn(1, pl.PlayerID, pl.PlayID)
                            advanceBatter = True
                        Else
                            ' the player was placed on base or advanced a base
                            Me.GameState_PutRunnerOn(pl.FinalBase, pl.PlayerID, pl.PlayID)
                        End If
                    End If
                End If
                If pl.PlayType = PLAY_TYPE_SUBSTITUTION Then
                    If pl.PlayerTeamID = hGuid Then
                        Me.homeLineupPlayerID(pl.BattingOrderPosition) = pl.PlayerID
                        Me.homeLineupPosition(pl.BattingOrderPosition) = pl.DefenseResult
                    Else
                        Me.visitorLineupPlayerID(pl.BattingOrderPosition) = pl.PlayerID
                        Me.visitorLineupPosition(pl.BattingOrderPosition) = pl.DefenseResult
                    End If
                    ' take the removed player off the base paths
                    BasePlayers_Remove(Me.firstBasePlayers, Me.firstBaseEvents, pl.RemovedPlayerID)
                    BasePlayers_Remove(Me.secondBasePlayers, Me.secondBaseEvents, pl.RemovedPlayerID)
                    BasePlayers_Remove(Me.thirdBasePlayers, Me.thirdBaseEvents, pl.RemovedPlayerID)
                End If
                If advanceBatter Then
                    If Me.inningTop Then
                        Me.visitorLastBatterUp = pl.BattingOrderPosition
                    Else
                        Me.homeLastBatterUp = pl.BattingOrderPosition
                    End If
                End If
            Next
 
            ' figure out the next batter
            If Me.inningTop Then
                i = Me.visitorLastBatterUp + 1
                If i > MAX_LINEUP_PLAYERS Then
                    Me.batterPlayerID = Me.visitorLineupPlayerID(1)
                Else
                    If Me.visitorLineupPlayerID(i) Is Nothing Then i = 1
                    Me.batterPlayerID = Me.visitorLineupPlayerID(i)
                End If
            Else
                i = Me.homeLastBatterUp + 1
                If i > MAX_LINEUP_PLAYERS Then
                    Me.batterPlayerID = Me.homeLineupPlayerID(1)
                Else
                    If Me.homeLineupPlayerID(i) Is Nothing Then i = 1
                    Me.batterPlayerID = Me.homeLineupPlayerID(i)
                End If
            End If
            Me.nextBatterUp = i
 
            ' fill in the defense array
            If Me.inningTop Then
                For i = 1 To MAX_LINEUP_PLAYERS
                    If Me.homeLineupPosition(i) >= 1 And Me.homeLineupPosition(i) <= posUpperLimit Then
                        Me.defensePlayerID(Me.homeLineupPosition(i)) = Me.homeLineupPlayerID(i)
                    End If
                Next
            Else
                For i = 1 To MAX_LINEUP_PLAYERS
                    If Me.visitorLineupPosition(i) >= 1 And Me.visitorLineupPosition(i) <= posUpperLimit Then
                        Me.defensePlayerID(Me.visitorLineupPosition(i)) = Me.visitorLineupPlayerID(i)
                    End If
                Next
            End If
 
            ' get the number of pitches and number of strikes
            sql = "contestid = '" + contestID.ToString + _
                                "' and pitcherplayerid = '" + Me.defensePlayerID(1).ToString + _
                                "' and playtype = " + PLAY_TYPE_PITCH.ToString
            Me.numberOfPitches = SDFDatabase.RecordCount(conn, "baseballplays", "playid", sql)
            sql = sql + " and pitchresult >= " + PITCH_RESULT_STRIKE_SWINGING.ToString
            Me.numberOfStrikes = SDFDatabase.RecordCount(conn, "baseballplays", "playid", sql)
 
        Catch ex As Exception
            Log("GameState_Get error: " + ex.ToString)
        End Try
 
    End Sub
 
End Class
 

paste below
title
language
description/question
action