Blog

Grab some tokens and let’s go! Here’s a simple game to play with a friend.

You will need

  • Some tokens
  • A friend to play with

What to do

  1. Put some tokens in a pile (around 12 will do to start).
  2. Decide who is going first.
  3. The first player must take either one or two tokens from the pile.
  4. The second player must then take one or two tokens from the pile.
  5. 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?

What’s happening?

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.

Applications

Nim is a game with 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.

If you’re after more maths activities for kids, subscribe to Double Helix magazine!

Subscribe now! button

One response

  1. ann dawson Avatar
    ann dawson

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

By submitting this form, you give CSIRO permission to publish your comments on our websites. Please make sure the comments are your own. For more information please see our terms and conditions.

Why choose the Double Helix magazine for your students?

Perfect for ages 8 – 14

Developed by experienced editors

Engaging and motivating

*84% of readers are more interested in science

Engaging students voice