The Rock Game


Play the rock game against the computer:

If you can see this text, your browser is not running this java applet.

The rules are simple. The players (you and the computer) take turns. On each turn, a player may take one, two, or three rocks. You take rocks by clicking on the button with the appropriate number. The player who takes the last rock wins.

You get to select the number of rocks we start with by setting the value at the top of the screen. Then click on the Restart button to start a new game. The computer always goes first.

A log of moves is kept in the scrolling window. The Clear button can be used to clear all of the text from this window. Moves are also recorded by changing the color of the rocks. Rocks taken by the human change from black to white with a blue outline. Rocks taken by the computer change from black to white with a red outline.

See if you can figure out how to beat the computer. Can you beat it starting with any number of rocks?


John Jones
Last modified: Wed Nov 4 21:08:46 MST 1998