Baseball game dev diary version 0.4.2.202011252200: 10,000 games in less than a second

I wonder how accurate it is to timestamp before and after code to determine how much time elapses during. Oh well, that's how I'm going to see how long things take.
  1. Changed txtOutput to display who’s up before plate appearance begins, and play result after. Rearranged beginPlateAppearance so check for winner and switching batter is after output of data.
  2. Public variables startmilliseconds and finishmilliseconds can be reused anywhere for checking time taken for various loops such as simming game.
  3. Sim Entire Game button added to sim everything from setting up teams to final pitch. Added time stamp before and after simming loop. Turns out it takes less than 1 millisecond to sim a game at present. 10,000 games simulated in 0.3 seconds! However, would need to also consider individual pitches, substitutions (presently no subs, no pitcher changes, and pitch counts are randomised). Would probably get away with less than 5 milliseconds per game with these included. 
  4. Winner variable moved from beginPlateAppearance sub to be a public shared so it can be used in the Sim Entire Game loop.
  5. Split resetGame into two parts (resetGame for data and resetInterface for interface). Again for simming purposes. Must remember to do this going forward.
I seriously did put in code to sim 10,000 games:

Next thing on the list to implement is individual pitches. Will start by randomising whether it's a ball or strike and randomising whether it is swung at. Won't be able to stop there and will probably end up doing the entire plate appearance logic in one sitting.

It just occurred to me some video evidence might be more engaging. After doing the pitch logic I'll consider recording a short 30-60 second clip showing how it works.

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