Baseball game dev diary version 0.1.0.202011082350: picking a winner

  1. Added call to checkForWinner function after each play, regardless of when. It checks scores when 3 outs in the top of the 9th, 3 outs in the bottom of the 9th and later, and after each play OR PITCH in the bottom of the 9th and later. If there is a winner (returns 0 or 1) it calls postgame procedure, otherwise (returns -1) adjusts inning if required.
  2. Added postgame procedure to output winning team to text box and disable plate appearance button. 
  3. Added reset button to reset all progress and start from inning 1 for testing purposes. Can be reset at any time.
  4. Improved form to have separate labels for each variable (inning, balls, strikes, outs, runs).
  5. Created code to convert inning to ‘top of’ (if a ½ value) or ‘bottom of’ (if whole number) and display inning number with correct suffix st, nd, rd, th etc (unless inning 121 is reached, in which case the inning number suffix won’t be the game’s most obvious problem).
  6. Moved output of data to form to its own procedure.
  7. Added skip to start of bottom of inning 8 button for testing purposes.
  8. Added multiline textbox to display the result numbers. Temporary.

That 'OR PITCH' in capitals in #1 looks like it's going to come back to haunt me later. I haven't implemented single pitches yet, still only simulating entire plate appearances. 

This is where I started thinking about putting in extra testing features (eg skipping to the start of inning 7.5 to test the end of game logic - brilliant!). Of course, adding in that testing feature required testing of its own... the irony... thankfully I got it right first time. 

Point 5 note about inning 121 is legit; if the game goes up to 121 innings it's going to say 121th instead of 121st (likewise 122th, 123th etc). I used combined case clauses that cover all innings to 103 and the else clause is to suffix the inning number with 'th'.

Looks like that night I got an extra nine minutes sleep.

Comments

Popular posts from this blog

MLB (Road to) The Show attribute progression

MLB The Show 21: create a stadium prediction & using created stadiums in online games

V1.1.4.202103032300 Basic player creator, line score tidy up and additional play results, including errors