DEV Community

sm.lee
sm.lee

Posted on

I built a baseball simulator in Python (with JSON-based teams)

engine
https://gist.github.com/ccf99187f6f438d18dae7adeafd584ab.git
main
https://gist.github.com/b6b79da45e8d896212a5b3b4214919b9.git
Teams
https://gist.github.com/64f40cf6a132812f2e7522333e2ddd62.git
teams
https://gist.github.com/863bde9738786ce7073b04c5504416e3.git

It's been just over two weeks since I started building my baseball simulation. I'll admit, the sheer difficulty of development has dampened my spirits at times. But I’m sticking to my '1% improvement' philosophy—challenging myself consistently, even if it's just a little bit each day.

I’ve refactored the project structure as follows:

Previous Structure:

Team files

Main (Execution)

Team Stats + Load Team + Prepare Next Batter (Combined)

New Refactored Structure:

Team files

Main (Execution)

Team Stats (Separated)

Load Team + Prepare Next Batter (Separated)

The reason for this separation is to minimize potential errors and ensure scalability as I add more teams to the simulation.

During this process, I faced numerous challenges—from base-stealing bugs to countless errors during the file separation phase. There were moments when I felt like giving up, but I pushed through by focusing on solving just one immediate error at a time.

I’m also learning a lot from AI about system architecture, file modularization, and how to improve overall code quality. A huge thank you to my followers and everyone who takes the time to read my posts!

[How to Run]
Please save the engine, main, Teams, and teams files separately. In the main file, update the from statements with the specific names of the engine and Teams files you are using before executing main.

Top comments (0)