Jeff C. Mercer - Portfolio

jlife - Documentation

Background

When I decided to do my own Java project, I chose a favorite topic of mine, cellular automa. More specifically, I decided to write a Java implementation of "The Game of Live", originally conceived and described by John H. Conway, mathematician.

In the April, 1970 issue of Scientific American (p. 120), Mr. Conway wrote about a sort of mental game or exercise involving a checkerboard. The game involves having pieces placed in just some squares on the checkerboard (or any grid, for that matter). Any square with a piece in it is said to be "alive" while the other squares (or cells) are "dead". Each square has eight adjacent squares or "neighbors". In his article, Mr. Conway establishes three simple rules for Life:

  1. Any occupied (live) cell that has less than 2 or more than 3 "live" neighbors, dies. Loneliness or over-crowding.
  2. A living cell with exactly 2 or 3 neighbor survives.
  3. Any empty cell that has exactly 3 neighbors is a "birth" cell and becomes occupied.
By following these three rules and applying them simultaneously over the playing field, it takes only several turns (or generations) before interesting patterns begin to emerge. Of course, trying to play this game in one's head is a bit difficult, and doing it with an actual checkerboard and checker pieces takes some time. But when Mr. Conway's rules of Life were applied in computer programs, the results were breathtaking. Over the decades, many unusual patterns (a collection of living cells in a particular arrangement) have been discovered which move, oscillate, and even seem to attack other patterns.

Since John Conway originally described his game, it has been written up in numerous articles (and even gets significant mention in Piers Anthony's SF novel "0X") and turned into literally hundreds of computer programs on all manner of platforms. My own Java implementation of Life is most certainly not the only one, though it is all original code.

I wrote jlife using Sun's free Java Development Kit v1.1.8 and the Windows 95 Notepad text editor. Initial testing of the applet was done using the appletviewer tool included with the JDK, then final tests were done with Netscape 4.6 for Windows 95 as well. Additional beta testers have run it under a variety of platforms including Linux, FreeBSD, Solaris, and MacOS 8.5. While Netscape for MacOS does not seem able to run the applet, one tester was able to get the jlife applet to run quite nicely using the MacOS applet viewer.

How To Use jlife

Once you jump to the jlife applet, you will get a display like this:

[jlife applet screenshot]
- Picture of jlife applet -

The black and white static is actually a randomly generated sequence or "seed pattern". If the area was just blank then the simulation would not produce any visual effect. Also notice the statistical data readouts:

When the jlife applet starts, nothing will happen until you (the user) presses one of the buttons at the top. The button functions are as follows:

System Requirements

Because this is a Java applet and thus can potentially run on dozens of different computer platforms, I will not attempt to give minimum system requirements for all of them. In simple outline, you will need to have a computer system capable of: In addition your web browser must support Sun's specification for Java 1.1, or the applet will not run. Older web browsers such as Netscape 3.x and Internet Explorer 2.0 do not have Java 1.1 support and thus can't run the jlife applet. Netscape 4.5 and higher should have support for Java 1.1, though some platform-specific or language-specific versions may lack it.

Known Issues

  1. Does not seem able to run in Netscape 4.x under MacOS. I think this is because I use multiple classes in separate files rather than a single applet class file.
  2. Runs very slowly in Netscape 4.x under various unix platforms. I suspect the unix version of the Netscape JVM lacks the optimizations that the Windows 32-bit version has.
  3. Hitting the Reset button in the applet while the simulation is running may have only a partial affect. This may be due to the way I've utilized threads.
  4. If the population stabilizes the simulation will continue to run steadily, rather than stopping or restarting. This was done deliberately.
  5. Statistical read-out values may potentially overflow if the simulation is allowed to run long enough.

Additional Links

Here are some links for further reading on Conway's Life and cellular automa in general.
[Return to jlife main page]

[My Resume]  [My Portfolio]  [News&Info]  [Contact Me]

Updated on 8/21/99 by Jeff Mercer <jcm@vaxer.net>