The Game of Nim

Nim is a game played by two players who play against each other. It starts with a board or any space containing 3 rows of matches, with the top row containing 3 matches, the second row 5 matches, and the bottom row 7 matches. Thus,




The players alternate turns in playing against each other, with each turn consisting of the player removing matches from the board. The object of the game to win is to cause your opponent to remove the last match from the board.

When it's your turn to move, you may select any row to remove the matches from, you must remove at least one match, or you may remove more than one match, any number of matches, up to all the matches from that row you selected. For example, if it is your turn to move and the board is the beginning set as above, and you decide to remove matches from the middle row containing 5 matches, you may remove 1 or 2 or 3 or 4 or all 5 matches from the middle row. If you decide to remove 5 matches from that row, the board will then have only two rows of matches remaining, the top row of 3 matches, and the bottom row of 7 matches. It then becomes your opponent's turn to move.

In any one turn, you may not remove matches from two different rows, you must remove at least one match, and you cannot remove more than the remaining matches from the one row that you decide to remove matches from. Once matches have been removed from the board, they may not be placed back on the board or into any row; removed matches are no longer in play. You may not move matches from one row to another row.

The object is to cause your opponent to remove the last match remaining on the board. You then win this game.

The key to playing to Nim is to try and think ahead to how your opponent will react to the move that you make, i.e. to ask yourself, if I remove x number of matches from this row, what will my opponent most likely do, and if he/she does that, what will I then do?

The game was developed during the early days of computer development when binary numbers were used to represent alphabet characters and numbers in the computer. Using binary addition, it is possible to develop the optimal strategy to try to win. But for our purposes here, let's just try to use this Nim game as a way of developing our analytic thought process to develop strategy, thinking through how an opponent might react, and how we then might react to his countermoves.

Go to    [ Solutions Page ]           [ Main Page ]