DEV Community

sm.lee
sm.lee

Posted on

Python Baseball Sim Update: Adding Pitcher Logic and JSON Data Support

https://gist.github.com/833dc3940ebaa3a7350de4ce60d17cb0.git
team file:
https://gist.github.com/0a03688247365ffa388011cd8008d74a.git

Body:
Hi everyone, I'm back with another update!

Today, I added "Pitcher Logic" to my baseball simulation. The game is getting much more realistic now.

The biggest change is the addition of a Pitcher’s Out Probability. If the pitcher is in top form and hits that probability, all potential hits—like singles, doubles, triples, and even walks—are converted into outs, except for home runs. It really captures that feeling of a pitcher dominating the inning!

For those who want to try the code: You can create your own team profiles and save them as .json files. Just make sure to adjust the file paths in the code to match where you saved them on your computer!

It's exciting to see how one new piece of logic can completely change the flow of the simulation. I’m slowly adding more layers to this project, and it’s been a great learning experience.

What do you think about this "Out Probability" logic? I'd love to hear your feedback!

Thanks for checking it out.

Top comments (0)