Introduction: How to Play and Win a NIM-game

A NIM-game is a tactical game.
It is played by two players who take turns and pick one or more objects from two or more rows.
The intention is to let the other player pick the last object.
The objects could be anything, from stones to coins.

I am going to teach you how you can play and win a NIM-game.
There is a version of a NIM-game on the internet called Pearls (
It is a good way to practice it.

Step 1: How to Play a NIM-game

I am going to teach you how to play a NIM-game using the site
This are the rules.
- in each game the pearls are grouped into horizontal rows
- in alternating turns you remove pearls from the game
- in a game you can remove as many pearls you want from any row you want
- the player who leaves the last pearl to the other player to take is the winner

(the pearls could be anything you want, but they are used in the internet game so I use them as a example)

Step 2: How to Win a NIM-game

When you try winning, you probably won't accomplish, because there is a trick to win every game.

1. When you want to win a game you first have to count the pearls in each row
for example: row 1= 6 pearls, row 2= 8 pearls

2. Convert the number of pearls into a binary number
for example: row 1= 0110, row 2= 1000
(when you don't know how to count with binary numbers, here is a tool to convert from decimal to binary.

3. Add the two binary numbers
for example:
1000 +

4. Change one row so the answer is 0000
for example:
0110 +
I changed the second row to 4 so the answer is 0000

5. Repeat step 1 up to 4 until you won the game
when you do this every time you will always win

When you have any questions, please discribe.