How to Win the Game of Nim

Nim was first introduced when computers were in its infancy, and the representation of numbers in computers used the binary system.  The binary system used a base of 2 which meant that each number had to be expressed using the digits 0 and 1 only.  Our current decimal system has a base 10, so that numbers are expressed using the digits 1 through 9.  To win at Nim, you had to represent the number of matches remaining in each line into the binary system, add the numbers, and then try to make your opponent face certain numbers when it was his turn to remove the matches.

However, while that was a good exercise to learn how to express numbers in the binary system, that is not our purpose here, but to illustrate why Nim is a good game for sharpening one's mind, in that it causes one to try to think ahead several steps to view possible actions and reactions.  Nevertheless, we will point out the formations which you want to achieve to cause your opponent to lose.
Formation When the opponent faces this formation on his move, he should lose...
1.          I By definition, with only one match remaining on the opponent's turn, he loses.
2.          I
             I
             I
Facing this formation, the opponent will lose, because he can remove only one match from any one line on his move, you remove the second match, and the opponent is left with one match remaining.
3.         I  I
           I  I
No matter what the opponent does, whether he removes one or two matches from either row, your move is the inverse of the number of matches he removes.  If he removes two, you remove one match from the other line.  If he removes just one match, you remove two from the other line.  Either scenario leaves one match remaining on one line facing the opponent.
4.         I
          I  I
         I I I
With this formation facing the opponent, whatever he does, your move should be to reduce the formation to one of the formations above, i.e. 1, 2, or 3.  By doing that, the opponent will be facing one of those three formations, which should cause him to lose.  So, for example, if the opponent removes the single match from the top row, your move should be to remove one match from the bottom row, thereby creating formation no. 3, i.e. two matches each in two rows.
The above are the basic formations you should try to achieve.  When there are more matches than those shown, try to reduce the formation to one of the formations shown.  You should win.

Return to  [ Problem Page ]            [ Main Page ]