Learning Languages with 543
When learning a new programming language, I like the idea of having a familiar program or algorithm to reimplement in the new language. My personal favorite is a little game that I prosaically call 543. I have no idea if there is an actual name for this game as it was taught to me in a bar. 543 is a two-player deterministic board game with very simple rules. It is perfect for the minimax algorithm - there’s enough complexity in minimax to use a fair amount of a language, but it can be written in a few hours if so motivated.
The Rules of 543
- There are three rows of pieces. The first row has 5 pieces, the second has 4 pieces, the third has 3 pieces.
- Each player takes turns removing pieces from the board. The player is only allowed to remove one or more pieces from a single row.
- The player that is left with the last piece on the board is the loser.