Alright, so I had this idea kicking around in my head for a bit – trying to model a baseball game. Not like a fancy video game or anything, just a simple simulation to see how the numbers might play out based on some basic stats. It felt like a decent little project to get my hands dirty with.

Getting Started
First thing, I needed a plan. I decided to keep it super simple initially. Forget fancy graphics or complex physics. I just wanted to simulate one at-bat after another and see what happens over a few innings. I figured I could use basic probabilities.
So, I grabbed some general league average stats – stuff like batting average, on-base percentage, maybe slugging percentage. Didn’t want to get bogged down in specific player data just yet, just wanted a feel for the overall game flow. I thought about using Python, as it’s pretty handy for this kind of stuff, but honestly, I first just sketched out the logic on paper and then tried parts in a spreadsheet to visualize the probabilities.
Building the Basic Logic
The core part was figuring out the outcome of each plate appearance. I started simple:
- Calculate the chance of getting on base (using OBP).
- If the batter gets on base, figure out if it was a walk or a hit (using BA relative to OBP).
- If it was a hit, decide if it was a single, double, triple, or homer (using rough percentages derived from slugging, maybe just simplifying heavily for starters).
- If the batter didn’t get on base, it’s an out.
This part involved a bit of fiddling. Getting the probabilities right, even in a simplified way, took some trial and error. I basically set it up so a random number determined the outcome based on these chances. You know, roll a virtual die, see what happens.
Adding (Some) Detail
Once I had the basic at-bat working, I realized I needed a bit more to make it feel like baseball. I had to track outs – three outs and the inning ends. I needed to track runners on base. This got complicated faster than I thought. How do runners advance on different kinds of hits? What about double plays on ground balls (which I hadn’t even modeled yet)?
I decided to keep the base running logic very basic for this first pass. Runners advance one base on a single, two on a double, etc. Stolen bases, errors, fielder’s choices? Nope, left all that out for now. It was getting messy, and I just wanted to see if the core simulation produced anything resembling a baseball score.
Running and Watching
So, I put it all together in a simple script. Nothing fancy, just text output showing the state of the game: inning, outs, score, runners on base. I let it simulate a full 9-inning game.
The first few runs were kinda wonky. Sometimes scores were ridiculously high, sometimes almost nothing happened. I tweaked the probabilities a bit, trying to get it closer to realistic scores. It was interesting just watching the text scroll by, seeing these little virtual players getting hits or making outs based purely on random numbers and league averages.
What I Reckon
It was a fun exercise, honestly. Showed me how even a simple model needs careful thought about the core mechanics. Trying to balance simplicity with realism is tricky. My little model was crude, yeah. It ignored pitching entirely, defense, specific player skills, parks – tons of stuff. But it did give a basic sense of how probability drives the game inning by inning.
It definitely wasn’t predicting anything real, but it was a good way to spend an afternoon messing with stats and code, just building something small from scratch to see how it worked. Made me appreciate the complexity simulators need to get even close to the real thing.
