DEV Community

sm.lee
sm.lee

Posted on

Building a Better Baseball Sim: Testing Logic with Manual and Probabilistic Inputs

https://gist.github.com/ad07af01cbbe20b787a50104393a9570.git
https://gist.github.com/d57f4cdbef10252d343575bb177590c5.git

Until now, I had been writing my baseball simulation code by simply accepting whatever the AI provided without proper verification. This led to several logical inconsistencies in the code. To truly learn and master the fundamentals, I’ve decided to start over. I am now manually inputting base-running, stealing, and batting scenarios to observe how the runners move and to solidify my understanding of the basics.

I have prepared two test files for this purpose:

The first file allows for manual input of all scenarios, including hits, walks, and steals.

The second file generates hits and walks based on probability, while still allowing for manual steal attempts.

I plan to continue testing by adding more features bit by bit. See you in the next update!

Top comments (0)