All posts tagged ‘Brian Eno’

File Under: JavaScript, Programming

Conway’s Game of Life in JavaScript

picture-5

The Game of Life, the most famous example of cellular automata and the basis of countless generative music, art and computer programming projects, has its own JavaScript simulator.

The concept, created in 1970 by the mathematician John Conway, relies on very simple rules applied to cells on a board. The cells are either “on/alive” or “off/dead,” and their behavior is determined by the states of their neighbors. There are rules — the human draws a pattern of cells on the board, then begins the game. The rules play out automatically and the game progresses without any further human interaction.

Brian Eno is a big fan. Check out his Bloom and Trope iPhone apps for some pleasant examples of generative game music done well.

Here’s the Game of Life as described by Wikipedia:

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:

1. Any live cell with fewer than two live neighbors dies, as if caused by underpopulation.
2. Any live cell with more than three live neighbors dies, as if by overcrowding.
3. Any live cell with two or three live neighbors lives on to the next generation.
4. Any dead cell with exactly three live neighbors becomes a live cell.

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.

See also: