The Game of NIM

What Is NIM Game About?

Nim is a simple game that can be played with matchsticks. Two players, in turn, remove a number of matchsticks from the board. The player who left with the last matchstick losses the game.

How to Play?

In the board of Nim, the matchsticks are arranged in multiple rows having 2n+1 matchsticks in each row. An example of the board in a 4-line configuration is given below.

I III IIIII IIIIIII

The rules of the game are as follows

  • The game is played in turns.
  • The player can remove matchsticks from only single row in their turn. They can remove any numbers of matchstick from the selected row. How- ever, they cannot remove matchsticks from multiple rows in one turn.
  • The player who removes the last matchstick losses the game.