LifeApplet - Project Description

Overview
This is a very simple applet which uses a cellular automaton to implement Conway's Game of Life. Basic details about the rules of the game and its implementation can be found below. For a more in-depth discussion of everything Life has to offer, check out one of the many web sites devoted to the game.

The Algorithm
Life works by applying a few simple rules to a grid of cells which start out in random states. Very quickly, the initial chaos lessens and the patterns that make life interesting begin to emerge.
The rules of life are simple:
  • If a cell is currently on and has 2 or 3 neighbors, it remains on - otherwise it turns off
  • If a cell is currently off and has 3 neighbors, it turns on - otherwise it remains off
The grid at the right indicates the cell (C) and the eight neighbors (N) that affect its future. For cells on the edges with no obvious neighbors, the cell array wraps around to the other side (this creates a torus). Given the current state of cells, the next generation is computed by looking at each cell and determining its future state according to the rules above. The result is stored in a separate location to avoid mixing the two generations (since cells depend on the states of other cells which may or may not have been updated yet). After all cells have been updated, the new generation is displayed and the process begins again.
+---+---+---+
| N | N | N |
+---+---+---+
| N | C | N |
+---+---+---+
| N | N | N |
+---+---+---+
Areas of Interest
Conclusion
This applet was a spin-off from FireApplet and has a very similar structure. It has been semi-optimized for speed through the use of table-lookups and some rather simple code tweaking. However, since generations that go by too quickly to be seen are of little interest, the applet has a rather long artificial delay between generations. I am satisfied with the results of this project - it represents a reasonably straight-forward set of modifications to an existing project, yet it yields very different behavior. I find that watching the patterns interact can be mesmerizing - it may be artificial, but it's Life!


The applet is available.
The source code is available for educational purposes.