# Nim

### Task 120 ... Years 2 - 8

#### Summary

Easy to state and easy to start, this logic game has more two it than appears at first site. Students might see it as 'just a game', however the game can be analysed and it reveals a connection between winning strategies and odd and even numbers.

Counters are arranged in four rows, 1, 3, 5 & 7, and players take turns to remove any number (including the whole row) from one row. The player who has to remove the last counter loses the game.

• 16 counters

#### Content

• problem solving strategies:
• What happens if...? reasoning, especially in connection with looking ahead
• working backwards
• breaking the problem into smaller parts
• simple number facts and relationships
• spatial perception
• square numbers

#### Iceberg

A task is the tip of a learning iceberg. There is always more to a task than is recorded on the card.

Students are sure to play this game without thinking too deeply when they begin, that is, just for fun. However, the iceberg question we want to encourage them to ask and analyse is:

Can we discover a winning strategy?
Doing so revolves around realising that it is not the number of counters that are left at any stage, but rather the number of possible moves that are left.
• For you to win your opponent has to remove the last counter, that is there must be one move remaining for them.
• Represented in numbers, this means your opponent must face 0 0 0 1, where the 1 could be in any row and means 1 counter remaining.
• If however, you leave them facing only two possible moves you will lose because they will do one of the moves and you must do the other. Therefore you will lose.
• After only one or two games students usually pick up that 1 1 1 0 is a winning position to leave. This is an odd number of moves to the end and the 0 may be in any row.
• Another winning position is 0 0 2 2. Again, the order of the numbers doesn't matter and you can't lose if you make the best possible moves.
This last arrangement is a useful starting point to help students dig deeper into the analysis. When analysing games you must assume your opponent plays as well as possible. You can't build a strategy on the assumption that your opponent will make a mistake. So in this case, it's no use the opponent arguing that they could win from 0 0 2 2 because if they remove one from one row you might make a mistake and remove only one from the other leaving 0 0 1 1 and they would win.

Encourage students to use 'if-then' reasoning to explore and record what could happen from this position.

• If the opponent removes one from one row, we remove two from the other and they have to make the last move - 3 moves to the end.
• If the opponent removes two from one row, we remove one from the other and they have to make the last move - 3 moves to the end.
The challenge now is to find all the winning positions. This can be a class challenge, rather than a challenge for one group. That is, create a Nim display which records strategies found by previous pairs and ask the current pair to see if they can find one more (...or show that we have found them all.)

One way to approach this investigation is to break the problem into parts:

• What are the winning positions with just one empty row, ie: one 0?
• What are the winning positions with just two empty rows, ie: two 0?
• What are the winning positions with just three empty rows, ie: three 0s?
Extensions
1. While the counters are on the table it is a good opportunity to connect with another aspect of mathematics. Ask the students if they have recognised the common characteristic of 1, 3, 5, 7. They are odd numbers of course. Now ask them if the total number of counters could be rearranged to make another special number. The total is 16, so students should be able to make a square. In this case the sum of the first 4 odd numbers makes a square of size 4. Would other lists of odd numbers make squares in this way?
2. Play Nim with only 1, 3 and 5 and the rule that the person who takes the last counter(s) is the winner. What are the winning positions for this game?

#### Whole Class Investigation

Tasks are an invitation for two students to work like a mathematician. Tasks can also be modified to become whole class investigations which model how a mathematician works.

All you need to turn this task into a whole class investigation is lots of counters. Poly Plug work beautifully. Begin by asking two students to be your demonstation players and work at their table with other students gathered around. This will clarify the rules, which you can also confirm by writing them on the board following the demonstration. Then proceed, guided by the information above, to hunt for all winning positions.

For more ideas and discussion about this investigation, open a new browser tab (or page) and visit Maths300 Lesson 79, Nim, which includes an Investigation Guide.

Visit Nim in Menu Maths Pack B.

#### Is it in Maths With Attitude?

Maths With Attitude is a set of hands-on learning kits available from Years 3-10 which structure the use of tasks and whole class investigations into a week by week planner.

The Nim task is an integral part of:

• MWA Number & Computation Years 3 & 4

The Nim lesson is an integral part of:

• MWA Space & Logic Years 5 & 6
• MWA Space & Logic Years 7 & 8