Python Baseball Sim Update: Adding Pitcher Logic and JSON Data Support
Source: Dev.to
Update Overview
Hi everyone, I’m back with another update! Today I added Pitcher Logic to my baseball simulation, making the game much more realistic.
Pitcher’s Out Probability
The biggest change is the addition of a Pitcher’s Out Probability. When the pitcher is in top form and hits that probability, all potential hits—singles, doubles, triples, and even walks—are converted into outs, except for home runs. This captures the feeling of a pitcher dominating an inning.
How to Use
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.
- Team file: https://gist.github.com/0a03688247365ffa388011cd8008d74a.git
- Main code: https://gist.github.com/833dc3940ebaa3a7350de4ce60d17cb0.git
Feedback
What do you think about this “Out Probability” logic? I’d love to hear your feedback!
Thanks for checking it out.