Alright, so today I’m gonna walk you through my experience with the “blue jays vs cubs” thing I was messing around with. It wasn’t about the actual baseball game, sadly – though I do enjoy a good game! It was actually a coding challenge a buddy of mine threw my way.

It all started when he said, “Hey, think you can simulate a simplified baseball game between the Blue Jays and the Cubs?” Naturally, I was like, “Sure, why not? Sounds kinda fun.” Little did I know, I was about to dive into a bit of a rabbit hole.
First things first, I had to figure out how to even start this thing. I decided to use Python, ’cause it’s what I’m most comfortable with. I fired up my IDE and just started typing. I knew I needed some basic stuff:
- Team objects (Blue Jays & Cubs)
- Players on each team (I just used placeholder names for simplicity)
- A way to simulate at-bats and scoring runs
So, I created a simple `Team` class with attributes like team name, players, and score. Then, I made up a bunch of random player names and stuck ’em in the teams. This part was surprisingly fun.
Next, the real challenge: simulating the at-bats. I wanted something that wasn’t just totally random, but also not super complicated. So, I decided to use probabilities. I assigned each player a “hit probability” (a number between 0 and 1) and used that to determine whether they got a hit in their at-bat.
I used the `random` module in Python to generate a random number between 0 and 1. If that number was less than the player’s hit probability, then they got a hit! Otherwise, it was an out.

Of course, just getting a hit isn’t enough to score runs. I had to simulate baserunning. I kept it simple: if a player got a hit, they advanced one base. If there were runners on base, they advanced too, potentially scoring a run. It was kinda janky, but it worked!
I then wrapped this whole process in a loop to simulate the innings. I decided to do just nine innings, like a regular baseball game. I kept track of the score for each team in each inning.
Now, for the moment of truth. I ran the simulation a few times, and the results were… interesting. Sometimes the Blue Jays would win, sometimes the Cubs would win. Sometimes the score would be super high, sometimes it would be a pitcher’s duel. It was pretty cool to see the different outcomes.
Of course, the simulation wasn’t perfect. It was very simplified. It didn’t account for things like different types of hits (doubles, triples, home runs), fielding errors, or pitching changes. But hey, it was a fun little exercise!
I think the biggest takeaway for me was just how much goes into even a simplified simulation like this. It really made me appreciate the complexity of baseball – and the power of Python!

Looking back, if I were to do it again, I’d probably try to incorporate some of those missing elements. Maybe add a “pitching skill” attribute to the pitchers and use that to influence the hit probabilities. Or maybe even try to simulate different types of hits.
But for now, I’m happy with what I came up with. It was a fun way to spend an afternoon, and it gave me a chance to brush up on my Python skills. Plus, I got to watch a few “Blue Jays vs. Cubs” games in my head – even if they were a little bit wonky. That’s how I did it and documented it, hope you like the share.