The Game of Life (an example of a cellular automaton) is usually played on an infinite two-dimensional rectangular grid of cells. In this implementation the sides are joined together to simulate a torus (doughnut) in 2D (you can see what it would look like in 3D here).
Each cell can be either alive or dead. Every cell interacts with its eight neighbours, which are the cells that are horizontally, vertically, or diagonally adjacent. At each step in time, the following transitions occur:
- Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.
- Any live cell with two or three live neighbours lives on to the next generation.
- Any live cell with more than three live neighbours dies, as if by overpopulation.
- Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.
Select cells in the grid by clicking on them or unselect by clicking them again. When you have an initial population of cells, click run to see what happens. Try to create periodic, static, and chaotic behavior.
Source: Conway's Game of Life