· 198 words · 1 minute read


Four-in-a-row or Connect-Four is a popular children’s game, where players in turns insert ‘coins’ into a contraption and try to connect their color coins in a row (check Wikipedia for the exact rules). As the game is quite simple, I implemented it on an Arduino to create the first ever* Four-in-a-rowbot!

The Four-in-rowbot can play against humans through a connected computer-interface or with implementations on another Arduino. The latter approach is what I had in mind; other programmers can try to compete with the implementation I created.

I chose the game Four-in-a-row because it is a simple turn-by-turn game, which still has some interesting game dynamics (you have to calculate a couple of steps ahead). The game had to be implementable in Arduino’s limited memory and at the same time not be completely trivial.

To help fellow-programmers, I provided a base-implementation with networking code they could use to extend and then use to ‘battle’ against my implementation. The intended competition never happened, but I did learn a bit more about Four-in-a-row’s optimal playing styles and Arduino’s RX/TX protocol.

If you’d like to experiment, you can download the Arduino-code.

Also, my Four-in-a-rowbot could beat Daniel’s implementation ;)

*I guess

A four-in-a-row bot