By David, 24 December 2013 Activity

- Some tokens
- A friend to play with

- Put some tokens in a pile (around 12 will do to start).
- Decide who is going first.
- The first player must take either one or two tokens from the pile.
- The second player must then take one or two tokens from the pile.
- Keep alternating turns until the last tokens is taken. The person who takes the last token is the loser.

Can you come up with a strategy that always wins? What if you start with a different number of tokens?

To work out how to win, it helps to work backwards. If it’s your turn and there’s only one token left, then you lose. This means that if it’s your turn and there are two or three tokens left, you should leave your opponent with one.

What if there are four tokens on your turn? If you take one, then your opponent will take two, and you lose. If you take two, then your opponent can take one, and you’ll lose. So if you can, you should try to give your opponent a pile of four tokens on their turn. Using this strategy, you should be able to win if there are five or six tokens in the pile at the start of your turn.

You can extend this sort of strategy as far as you want. In order to win, you should always give your opponent a number of tokens that is a multiple of three, plus one more. Then, if they take away one, you take two, and if they take away two, you take one. This guarantees they will always receive a pile with one more than a multiple of three tokens. Eventually, you will give your opponent seven counters, and then four counters, and finally one counter.Nim is a very special game because it has a strategy that will always win, no matter what. Most games don’t have a definite winning strategy. There are several reasons why Nim is like this.

Firstly, there are no random parts to the game. You never roll dice, or draw cards – the only things that matter are what you and your opponent do. Secondly, there’s no way to have a tied game, so one of the players is going to win. Thirdly, the game has to end after a certain number of turns. Some games can get caught in a loop so that they never end, but Nim can’t have more goes than there are tokens at the start. Finally, it is also a two player game. If you have three or more players, then the result can depend on how nice the other players are to you.

Any game that has all of these properties will have a definite winning strategy for one of the two players, although that strategy is not always easy to find. For example, the first player doesn’t always have the winning strategy. If you play Nim starting with seven tokens, the second player will win if they play correctly, and the first player can’t stop them.

Nim on Wikipedia (more advanced)

Did you like this activity? Subscribe to Maths and Stats by Email!

December 30, 2013 at 9:44 pm

I love this game, though I find it infuriating, as I’m pretty poor at strategy, lol