HTML and JavaScript for Nim © Copyright 2004 by James Larson
Number in pile
1 2 3 4

How to play Nim

Nim is played with a pile of objects. In this version, each player gets to take 1, 2, 3, or 4 objects from the pile until only one remains. The player that leaves the other player with just one object is declared the winner.

When this page first loads, or after clicking on the button, the player is asked to enter the starting number of objects. Acceptable values range from 15 to 99. After that, the player gets to go first. Click on one of the radio buttons to make your selection. The computer will then make its move, and so it goes, until only one object is left.

Visitor #

This classic computer game has been written and distributed by

James Larson
Programmer/Analyst Consultant
E-mail address
In God We Trust...