During my last Christmas holiday at home I stumbled upon a 90s children's bedroom staple, a 3D Connect Four game made of wood:
We played a few games and I became interested in figuring out whether there's a computational way to determine the best strategy or even train a model to play against.
The first step I took was to build a 2D Connect Four game from scratch, to be played in the terminal. It's a common coding channel at universities and bootcamps and there are plenty of repos. I purposefully chose not to look at any of them and instead came up with my own approach.
2D Connect Four has an interesting history — entire Master's theses have been written about the game, and solving Connect Four positions is also used as a benchmark for computer performance.
I used Replit again so you can try it out yourself here. After every move the code checks whether one of the three winning options is fulfilled, namely four stones in a row vertically, horizontally or diagonally. If so it announces the winner and ask whether you want to play again. Here's what it looks like during the game:
It's work in progress. There are two options that I'm considering which lead to different learning outcomes:
Right now it looks like option 1, if I can get away from a GPT-based project.