About Matchsticks
Matchsticks is a version of the ancient game of Nim played with four rows of sticks. Players take turns removing sticks, and the twist is that whoever takes the very last stick loses. It looks like a game of chance, but it is entirely a matter of calculation.
How to play
- The game starts with four rows of 1, 3, 5 and 7 sticks, 16 in total. You always move first.
- On your turn, take one or more sticks from a single row. You can take a whole row if you like, but you cannot take from two rows at once.
- Players alternate until every stick is gone. Whoever takes the last stick loses, so the player who forces the opponent to take it wins. This is the misere form of Nim.
- There are two difficulty levels, Easy and Hard. Changing the level starts a new game.
- The Wins counter tracks how many games you have won, and your Best is the highest number of wins you have reached.
Controls
- Click or tap a stick to select it and every stick to its right in that row. The selected sticks lift up.
- Press the Take button to remove the selected sticks and end your turn. Clicking a different stick before pressing Take changes the selection.
- Choose Easy or Hard from the drop-down menu above the board.
Tips and strategy
- Write each row size in binary and combine them with exclusive or, also called the nim-sum. In the middle of the game you want to leave your opponent a position where the nim-sum is zero.
- The starting rows 1, 3, 5 and 7 already have a nim-sum of zero. That means the player to move, which is you, is at a disadvantage against perfect play.
- The endgame is different from ordinary Nim. When only one row has more than one stick left, reduce it so that an odd number of single-stick rows remains.
- On Easy, the computer sometimes makes random moves. Play carefully, wait for a mistake, and then restore a zero nim-sum on every turn after that.
- Simple patterns help: two equal rows can be mirrored, and leaving rows of 1, 2 and 3 to your opponent is a win for you.
Background
Nim-style games of taking objects from piles have been played for centuries. The name Nim was given by the Harvard mathematician Charles L. Bouton, who published a complete winning strategy in 1901 using binary arithmetic, one of the first results of what became combinatorial game theory. The 1, 3, 5, 7 layout used here is famous from the 1961 French film Last Year at Marienbad, in which one character repeatedly wins a version of the game where taking the last piece loses.
Questions
- How strong is the computer?
- On Hard it plays the perfect misere Nim strategy. Since the starting position is already a losing one for the player who moves first, and you always move first, Hard cannot be beaten. On Easy, about 35 percent of its moves are random, which gives you chances to take over.
- Can I take sticks from more than one row?
- No. Each turn you take any number of sticks, but all from the same row.
- Why did I lose when I took the last stick?
- That is the rule here: whoever takes the very last stick loses. Try to leave your opponent with one stick in total.