Game of life

In 1970 John Conway developed a cellular automation known as Game of Life. The program is a 2D grid of square cells which can be in either “alive” or “dead” state. Each cell interacts with its 8 neighbours, which are horizontally, vertically and diagonally adjacent.

The rules are simple:

  1. Each cell with one or no neighbors dies, as if by solitude
  2. Each cell with four or more neighbors dies, as if by overpopulation
  3. Each cell with two or three neighbors survives
  4. Any dead cell with exactly three live neighbours becomes a live cell, as if by reproduction.

Complex patterns can be observed from this simple rule and can be considered a mathematical beauty.

Here is a simple implementation using p5.js.
*Left click to populate a cell / Right click to unpopulate a cell


Some popular patterns
Resources