Powerful numerical tools for everyday use

Nim Game

Ancient mathematical strategy game of perfect information

You
Wins: 0
Your turn. Select objects to remove.
Computer
Wins: 0
Nim-Sum Strategy Analysis

The Nim-sum is the XOR (exclusive OR) of all heap sizes. A winning position has a Nim-sum of zero in normal play.

You won! You've mastered the Nim strategy.

How to Play Nim

Nim is an ancient mathematical game of strategy. The game starts with several heaps of objects. Players take turns removing any number of objects (at least one) from a single heap. The player who takes the last object either wins or loses, depending on the variation.

Game Variations:

  • Normal Nim: The player who takes the last object loses.
  • Misère Nim: The player who takes the last object wins.

To make a move:

  1. Click on objects in a single heap to select them
  2. Click "Remove Selected" to complete your move

Strategy Tip: The optimal strategy for Nim involves understanding the "Nim-sum" (binary XOR) of all heap sizes. In normal play, you want to leave a Nim-sum of zero after your move.