Nim facts for kids
Nim is a fun and strategic mathematical game for two players. In Nim, players take turns removing objects from different piles. These objects can be anything like matches, coins, or stones.
Here are the basic rules:
- On your turn, you must remove at least one object.
- You can remove any number of objects.
- However, all objects you remove must come from the same pile.
- The goal of the game can change:
- In the most common version, the player who takes the last object wins.
- In another version, called misère play, the player who is forced to take the last object loses.
Contents
What is Nim?
Nim is a type of combinatorial game. This means it's a game where players take turns, there's no luck involved (like rolling dice), and everyone knows everything about the game. It's all about planning and thinking ahead!
Where Did Nim Come From?
People have played games like Nim for a very long time. Some historians think it might have started in China. There, a similar game is called jiǎn-shízǐ, which means "picking stones."
The game was first written about in Europe in the early 1500s. The name "Nim" was given to the game in 1901 by Charles L. Bouton. He was a professor at Harvard University. He also figured out the full math strategy to win the game every time! The name "Nim" might come from the German word nimm, meaning "take."
Nim-Playing Machines!
Because Nim is so mathematical, it was one of the first games computers were made to play!
- At the 1939 New York World's Fair, a company called Westinghouse showed off a machine called the Nimatron. This machine played Nim against people. For six months, only a few people managed to beat it! If you won, you got a special "Nim Champ" coin.
- Later, in 1951, another company called Ferranti built a computer called Nimrod. It also played Nim and was shown at the Festival of Britain.
- Engineers even built a Nim-playing machine using tinkertoys!
The game of Nim was also in a famous article by Martin Gardner in Scientific American magazine in 1958. It even showed up in a French movie called Last Year at Marienbad (1961).
How to Play Nim
Nim is usually played with three piles of objects. But you can use more or fewer piles. You can also choose how many objects are in each pile to start.
Winning or Losing the Last Object
Remember, the game's goal changes based on the version:
- Normal Play: The player who takes the last object wins. This is the most common way to play.
- Misère Play: The player who is forced to take the last object loses.
An Example Game
Let's see an example of a normal game of Nim. Two players, Bob and Alice, start with three piles. Pile A has 3 objects, Pile B has 4, and Pile C has 5.
Pile A | Pile B | Pile C | Move |
---|---|---|---|
3 | 4 | 5 | Game begins |
1 | 4 | 5 | Bob takes 2 objects from Pile A |
1 | 4 | 2 | Alice takes 3 objects from Pile C |
1 | 3 | 2 | Bob takes 1 object from Pile B |
1 | 2 | 2 | Alice takes 1 object from Pile B |
0 | 2 | 2 | Bob takes all 1 object from Pile A (leaving two piles of 2) |
0 | 1 | 2 | Alice takes 1 object from Pile B |
0 | 1 | 1 | Bob takes 1 object from Pile C (leaving two piles of 1) |
0 | 0 | 1 | Alice takes 1 object from Pile B |
0 | 0 | 0 | Bob takes the last object from Pile C and wins! |
How to Win at Nim
Nim has a perfect winning strategy based on math! The main idea is to always leave your opponent in a "losing position." A losing position means the next player is forced to lose if the other player plays perfectly.
If you start in a winning position, you can always make a move to leave your opponent in a losing position. If you start in a losing position, you will lose if your opponent plays perfectly.
Examples of Losing Positions
Here are some examples of "losing positions." If you can leave your opponent with one of these pile arrangements, you're on your way to winning!
2 Piles | 3 Piles | 4 Piles |
---|---|---|
1 1 * | 1 1 1 ** | 1 1 1 1 * |
2 2 | 1 2 3 | 1 1 n n |
3 3 | 1 4 5 | 1 2 4 7 |
4 4 | 1 6 7 | 1 2 5 6 |
5 5 | 1 8 9 | 1 3 4 6 |
6 6 | 2 4 6 | 1 3 5 7 |
7 7 | 2 5 7 | 2 3 4 5 |
8 8 | 3 4 7 | 2 3 6 7 |
9 9 | 3 5 6 | 2 3 8 9 |
n n | 4 8 12 | 4 5 6 7 |
4 9 13 | 4 5 8 9 | |
5 8 13 | n n m m | |
5 9 12 | n n n n | |
* This position is a losing position for normal play (taking the last object wins). ** This position is a losing position for misère play (taking the last object loses). |
In the table, 'n' and 'm' can be any number greater than 0. They can also be the same number.
If you want to become a Nim master, you can learn about the "nim-sum." This uses binary numbers (a way of counting with only 0s and 1s) to find the perfect move every time!
See Also
- In Spanish: Nim (juego) para niños