🪨

Nim

Take stones to force your opponent to take the last one!

Share:PostRedditShare
📖
Related Article
Chain Reaction Web Game Free Online | Exploding Orbs

You might also like

🔢
2048
💣
Minesweeper
🔢
Sudoku
🟤
Checkers

Frequently Asked Questions about Nim

How do you play Nim?
Players take turns removing one or more objects from a single row. You can take as many objects as you want from one row per turn, but you must take at least one. The player who takes the last object loses (in normal play) or wins (in misere play).
Is Nim free to play online?
Yes, this version is entirely free. Play against the computer right in your browser with no download or account required.
What is the XOR strategy in Nim?
The winning strategy involves calculating the binary XOR (nim-sum) of all row sizes. If the nim-sum is zero after your move, you are in a winning position. This mathematical approach guarantees a win when played perfectly from a winning position.
Can you always win at Nim?
If the starting position has a non-zero nim-sum and you play first with optimal strategy, you can always win. However, if the starting nim-sum is already zero, the second player has the advantage. The AI in this game uses optimal strategy on harder difficulties.
What is the difference between normal and misere Nim?
In normal Nim, the player who takes the last object wins. In misere Nim, the player who takes the last object loses. The strategy is nearly identical except for the endgame, where you need to leave an odd number of rows with exactly one object.

About Nim

Nim is one of the oldest known strategy games in mathematics, with roots stretching back centuries. The rules are simple: several rows of objects are laid out, and two players take turns removing any number of objects from a single row. The player forced to take the last object loses. Despite its simplicity, Nim has deep mathematical strategy based on binary XOR calculations that guarantee a win for the player who understands the theory. Playing against the AI on various difficulty levels lets you discover these optimal strategies organically. The game also serves as an excellent introduction to combinatorial game theory, a branch of mathematics that analyzes turn-based competitive games. It is a timeless battle of wits that rewards careful thinking over luck.

How to Play

  1. Choose a row and click to remove one or more objects from that row only
  2. The goal is to avoid being the player who takes the last remaining object
  3. Think ahead and consider how your move changes the balance across all rows
  4. Try to leave your opponent in a losing position using strategic removals