Conway's game of life.
This is a Mootools Object Oriented JavaScript Application based on the ever popular
Conway's game of life.
The universe of the Game of Life is an infinite two-dimensional orthogonal grid of square cells,
each of which is in one of two possible states, live or dead.
Every cell interacts with its eight neighbors, which are the cells that are directly horizontally,
vertically, or diagonally adjacent.
At each step in time, the following transitions occur:
- Underpopulation: Any live cell with fewer than 2 live neighbours dies.
- Overcrowding: Any live cell with more than 3 live neighbours dies.
- Stasis: Any live cell with 2 or 3 live neighbours lives another generation.
- Reproduction: Any dead cell with exactly 3 live neighbours becomes live.
The initial pattern constitutes the seed of the system. The first generation is created by applying the above rules simultaneously to every cell in the seed. Births and deaths happen simultaneously, and the discrete moment at which this happens is sometimes called a tick (in other words, each generation is a pure function of the one before). The rules continue to be applied repeatedly to create further generations.
Application controls are as follows:
- Mouse: Left-click and drag to toggle cells.
- Slider: Controls the density of seed life 0-99%.
- Reset: Start over with random seed data.
- Step: Make one new generation.
- Stop: Stop making new generations.
- Start: Make new generations as fast as the browser allows.
On my dev box [Intel core2duo@3.00 GHZ, 2.75 GB Ram] FPS are as follows:
- Chrome 5.0.366.2: Between 25 and 50 FPS.
- Opera 10.51: Between 15 and 25 FPS.
- Safari 4.0.5: Between 10 and 20 FPS.
- Firefox 3.6.2: Between 5 and 10 FPS.
- IE 8.0.6001: About 1 FPS, sometimes slower.