Peter Alfeld, --- Department of Mathematics, --- College of Science --- University of Utah

The Game of Sprouts

However, your browser does not support Java. If it did you would not see this message! Get a java compatible browser such as Netscape, of a sufficiently advanced version.

The Game of Sprouts

The applet on this page will bring up a window that lets you play sprouts against a human opponent. Of course you could also do this using paper and pencil. However, eventually you should be able to play against the computer. I'm intrigued with this project because it involves some fascinating programming problems.

In the game of sprouts two players start with some number of dots and alternate making moves. A move consists of connecting two dots called spots) with a curve and marking a new dot anywhere on the curve. The segments of curves connecting two dots are called edges. subject to the following rules:

  1. The curves do not intersect (other curves or themselves).
  2. No more than three edges emanate from any one spot.
  3. A curve may connect a spot to itself.

The player who draws the last curve wins.

Playing the Game

To play the Game just click on the applet. To draw a curve move the cursor to the starting spot. Once it's close enough to change its shape to a crosshair press the (left) mouse button and drag the mouse to the end spot. The program will draw the curve and mark the new spot. Colors of the spot indicate the number of edges that can still be attached to the spot, ranging from 3 (blue) through 2 (cyan), 1 (magenta) and zero (gray).

When you draw a curve it first shows as a green line (for the first player) or a red one (for the second player). If the curve is valid it turns into a black line with the new spot somewhere along it. If it's invalid (for example because you moved off the screen or ran into an existing curve) it turns yellow and disappears when you draw the next curve.

You can modify the game using the following options:

More detailed documentation and discussion is forthcoming.

Downloading the code

The code can be used in standalone mode. Indeed, this is preferable because you are not at the mercy of quirks of your particular browser. For example, with my particular version of netscape the code does not react to keyboard commands.

To invoke the code on a Unix system type

java Sprouts 

Last change: [18-Jun-1999]

Copyright © 1998 Department of Mathematics, University of Utah