Free Software by Sam Clippinger -- JSlife

Author: Sam Clippinger <samc (at) lookandfeel (dot) com>
Copyright: ©2002 lookandfeel new media
License: GNU GPL
Current version: 2.0.0.0 Archived versions: All versions Documentation: Change Log
Dependencies: A working Javascript and CSS browser. Tested successfully in Mozilla 1.1 (Win32), IE 5.01 (Win32) and IE 4.5 (Mac). A fast computer is very important.

Source language: HTML 4.0, Javascript 1.2
Target platform: Web browsers with working Javascript and CSS support.
Description: JSlife is a Javascript/DHTML implementation of Conway's classic "game" of "life". NOTE: It isn't really a game and bears no resemblance to the popular board game of the same name.

Life plays out on a grid of squares where each cell is born, lives and dies according to the number of neighbors it has. A cell's "neighbors" are the eight squares immediately adjacent to it. If a dead cell is surrounded by exactly three living neighbors, it is "born" and is considered "living" at the start of the next turn. If a living cell has two or three living neighbors, it remains "alive" at the start of the next turn. If a living cell has any other number of living neighbors, it "dies" and is considered "dead" at the start of the next turn.

Some implementations extend this idea by giving the cells ages, so they will not die immediately if abandoned or overcrowded. This implementation does not do this -- cells are bits; alive or dead. Living cells are gray, dead cells are white.

In this implementation, clicking a cell at any time will reverse its state (living cells become dead and vice-versa). The action can be started by clicking "Start" and will run until the number of remaining iterations reaches 0. An "iteration" calculates a number of rounds and updates the display to show the results. The most interactive way to run the simulation is to perform one round per iteration (the default) so the screen will update constantly. Because updating the screen is slow, more rounds can be performed between updates by increasing the number of rounds per iteration.

There are several counters shown on the screen to display some performance data if you're interested in how fast your browser runs Javascript.

Note that if your screen does not update after every iteration, try setting the delay to a number greater than 0. The grid size can be increased by editing the top of the source file.

Click here to run the latest version of JSlife.


This project is mirrored from freesoftware.lookandfeel.com.