Head office, Rana Pratap Bagh, Delhi011 2721 1512+91 97116 99511

Science project idea

Matchstick Nim game board with its unbeatable strategy

Two players take 1, 2 or 3 sticks in turn from a pile of 21 and the player who takes the last stick wins. Whoever leaves a multiple of 4 after their move (20, 16, 12, 8, 4) can always win, so the second player wins a game of 21 by always making the two moves in a round add to 4.

What it shows

Two players take 1, 2 or 3 sticks in turn from a pile of 21 and the player who takes the last stick wins. Whoever leaves a multiple of 4 after their move (20, 16, 12, 8, 4) can always win, so the second player wins a game of 21 by always making the two moves in a round add to 4.

The science

Work backwards. A player facing 1, 2 or 3 sticks wins at once. A player facing 4 sticks must leave 1, 2 or 3, so they lose. Facing 5, 6 or 7 you can leave 4 and win; facing 8 you lose, and so on. Every multiple of 4 is a losing position for the player about to move. Since 21 is not a multiple of 4, the first player can win by taking 1 to leave 20, and then always taking 4 minus whatever the opponent took. This is a simple example of a game solved by finding its invariant.

Materials

Cost: free. Many items come from home or from waste; spare parts such as LEDs, motors and wire are in the store.

  • 21 matchsticks, straws or pencils
  • A board marked with 21 slots
  • A score sheet
  • Two players and a referee

Safety

For this project: Use burnt matchsticks or straws so there is nothing to strike.

Never use mains electricity: power models with cells, batteries or a low-voltage adapter. Sharp and hot tools, flames and lab chemicals need an adult or your teacher beside you. Keep magnets, button cells and small parts away from young children, and wash your hands after making.

All the safety rules

Step by step

7 steps. Do them in order, and test each part before you go on to the next. Write what you notice in a notebook as you go.

  1. Set 21 sticks in the slots and explain the two rules: take 1, 2 or 3 per turn, and the one who takes the last stick wins.

  2. Play ten games freely and record who won and how many sticks were left before the winner's last move.

  3. Play a version starting with 4 sticks and see that the player who moves first always loses. Try 8 sticks.

  4. Make a table from 1 to 21 marking each number win or lose for the player about to move; the lose numbers are 4, 8, 12, 16, 20.

  5. Now play from 21 with one player using the strategy: take 1 first, then always take 4 minus the opponent's last move.

  6. Record ten more games; the strategy player should win every time.

  7. Change the rule to taking 1, 2, 3 or 4 sticks and work out the new losing numbers, which are the multiples of 5.

What you should see

The table shows multiples of 4 as losing positions, and the strategy player wins all ten games from 21 by leaving 20, 16, 12, 8 and 4 in turn.

Viva questions

A teacher or a judge will ask how it works. Try to answer each question before you open it, then compare.

1Facing 10 sticks, how many should you take?

2, to leave 8, a multiple of 4.

2Who wins from 16 sticks with best play?

The second player, because 16 is a losing position for the one about to move.

3What changes if you can take up to 4 sticks?

The losing positions become multiples of 5, since the two moves in a round can be made to total 5.

4What if the player who takes the last stick loses instead?

Then you want to leave your opponent 1, 5, 9, 13, 17 or 21, one more than a multiple of 4.

Free ebook: Viva Questions for Science Projects

Take it further

Study the three-pile version of Nim and find the rule that uses binary addition without carrying.

Change one thing, measure what happens, and add a table or chart of your readings: that is what turns a model into your own investigation.

Free ebooks for this project

WhatsApp us