|
I often used the game of NIM in my computer programming classes and even in my math classes (when we studied number bases). I would play against the whole class (and offer to cancel homework if they could beat me in two out of three games).
Rules:
I often use the following configuration for the board: / / / / / / / / / / / / / / / / / / / / / / / / What is the strategy for playing?
1. You must first represent each row of objects as a binary number. Example: Let's use the configuration above for the opening board (4 rows -- 3, 5, 7, and 9 objects). Here are the base two representations of the four rows at the start of the game:
the 4s column has an even number of ones (there are 2); the 2s column has an even number of ones (there are 2); the 1s column has an even number of ones (there are 4). So, if you are moving first, you can assure yourself of victory by removing 8 objects from row 4. This leaves your opponent with an even number of ones in each column. (see the table below)
Let's assume that your opponent removes 6 objects from row three.
You want to remove the one in the 4s column and put it back in the 2s column. Hence, you want to subtract 4 but add back 2 for a net removal of 2, leaving 3 objects in row 2. Then the board looks like this (in base 2):
Note that you have again left your opponent with an even number of ones in each column!
|
Click here for a non mathematical explanantion of NIM |
|---|
Math Games |
|---|
Mr. P's Puzzles and Games Page |
|---|