Sorry, your browser does not support Java.

This web page is a Java applet to play John Conway's Game of Life.  For reference, see articles in "Scientific American" (October 1970 and February 1971) and "Time" magazine (21 January 1974).

Life is not your average two-player game.  You and the computer work together, with you making decisions, and the computer doing calculations.  You define a board pattern and then watch as the computer projects future generations of this pattern.  Even with some of the most trivial initial patterns, you can obtain results that are both beautiful and intriguing.

Cells (squares) on a rectangular grid are either empty or full (occupied).  The next generation is calculated by counting the number of occupied neighbors, up to a maximum of eight.  Fewer than two neighbors, or more than three, results in death: the cell will be empty in the next generation.  No change is made if there are exactly two neighbors.  Exactly three neighbors results in a birth: the cell will be occupied.  This updating is "instantaneous" and does not change squares before everybody's fate has been determined.

Click the mouse to change a cell.  If the cell is currently empty, then it will be filled.  If the cell is currently full, then it will be emptied.

Try the 8-generation Cheshire cat pattern ("." are empty; "O" are full):

. . . . . . . . . .
. . . . . . . . . .
. . . O . . O . . .
. . . O O O O . . .
. . O . . . . O . .
. . O . O O . O . .
. . O . . . . O . .
. . . O O O O . . .
. . . . . . . . . .
. . . . . . . . . .
Cells are shown in color.  A cell with the background color is empty, and has been empty for a while.  A blue cell is a death: newly empty.  A green cell is a birth: newly occupied.  A white cell has been occupied for a while.


If this web page begins with an error message saying that your browser does not support Java, then either your computer doesn't have Java, or Java is not enabled.  If you see an empty rectangle where the applet should be, then you have Java but need a newer browser or a newer version of Java.  For Internet Explorer 5 or later, Firefox, Mozilla, and Netscape 7.x or later on Windows, you may download the Sun Java run-time environment (JRE) from http://www.java.com/getjava/ on Sun's web site.  This program was written on and tested against Sun Java 1.4.

The source code for this applet is available, even though writing a similar Java program is an assignment for students, and I'm sure that some students won't do their own homework.  (Hint: put an empty border around your internal game board, to avoid having special cases when counting the number of neighbors.)  You may also download the application as a ZIP archive with the executable Java class files and the documentation in Adobe Acrobat PDF format.  More programming assignments and solutions can be found on my "Computer Programming Examples" web page.

Copyright (c) 2004 by Keith Fenske.  Released under the GNU General Public License (GPL).