Coding baseball project


At the beginning of this year I decided I wanted to have a go at coding a baseball game. I'm not talking The Show standard of course (converting real-world thinking into computer logic is my strength, animation is my weakness), but something that would scratch the itch of curiosity I had about just how much fun it would be to work on and produce something that I could use as a learning exercise, a teaching tool and more importantly, something that others might actually find engaging.

Of course, life took over and I didn't actually progress beyond some sketches on paper and iPad. That is until around six weeks ago when the right time to start came about and I decided that doing something - anything - was better than putting it off. So I sat down and wrote some code.

Thus my project was born.

Admittedly, version 0.0.1 was literally a randomised outcome of a single plate appearance, but hey, the hardest part about having big ideas has always been getting started.

It has progressed a hundredfold since that humble beginning and as one of my goals is for it to be a tool for teaching programming, I have decided to share some aspects of my work. It has basically only been four weeks since this became more than just a few random numbers being generated so don't expect too much.

(By the way, if there's one visual that would help outsiders better understand just how hard it is to write software it's that one with the chimpanzee carrying an armful of oranges and when one drops and the chimp picks it up another drops, so he picks that one up and another drops etc... That's precisely what software development is like when programs start getting expanded. One luxury I have however, that commercial devs don't, is that I am afforded the time to pick up the orange and think about where it should go back into the stack. Sometimes I might even put down the stack and reconfigure how they are stacked to improve my walking efficiency, or minimise the chance of new oranges on the pile pushing others off.)

Anyway, to cut a long story short, like any good dev I'm documenting changes with each version, but I thought I'd put them on the line for anybody who is interested in following:

For the latest version I posted a short demonstration video in which I explain key things about how it works; past posts and future posts go into more detail about additions and changes to the program.

I'm not posting the actual code or compiled program for obvious reasons, so if you would like to try it for yourself, I apologise, it's not possible, at least until I decide to create a web version (which could very well be where I'm headed).

I anticipate that in a couple of years time I'll be fairly close to what I set out to achieve back in January 2020. There's a niche market that I would like to fill.

If you're interested in programming and/or baseball, I invite you to follow my journey.


I've added a game log and plate appearance log to my simulator now.

Read and watch here.

It presently still has only six possible outcomes for each play (strikeout, walk, single, double, triple, homer) - that's something I'll work on in the future, but now every single play in a game - clicked through or simulated - is recorded in the game log. Plate appearance log is there too, capturing the pitch sequence in the current plate appearance.

So far this is an immensely enjoyable and challenging experience. I've got approximately 700 lines of super-efficient code so far and haven't even scratched the surface of what I'm going for.

To be continued...


Very cool 👍