Conway’s “Game of Life”

This is an implementation of the famous “Game of Life” by John H. Conway. You can click on a cell to create or remove an “organism”. When you click start, the organisms grow and die according to some simple rules.

  • any organism with less than 2 or more than 3 neighbors will die
  • any empty location with 3 neighbors will spawn a new organism
Sadly, the <embed> tag doesn't work

Source

See the source.

You’re right, there are no comments.

Implementation Notes

This implementation uses a Cell class which is an java.util.Observable. Each cell has a corresponding Panel in the grid, which is the Observer. As the Cell changes state the Observer updates the display. This is a fairly high overhead solution: cells objects have only a few bits of data, but is elegant in that only updated cells are redrawn.

Note that the cycle is a separate Thread, created by Start and destroyed by Stop.

Possible Extensions

One might want to change the size of the applet (300x333), the number of cells (30x30), the speed of refresh (500 ms).

One might want to provide a pallet of interesting shapes (glider, r-pentomino, etc.)

One might want to try and detect a cycling steady state. An empty grid, steady state or a two-step cycle would be easy to detect. More complex cycles would be hard to evaluate without keeping a history indexed by number of organisms alive.

Table Of Contents

Previous topic

Projects in Java

Next topic

HamCalc