Life, devised by John Conway, is a zero-player game that, while simple, has roots in automata theory, evolution, chaos theory, AI, Gödel's incompleteness theorems, free will, etc.

A cellular automaton is a collection of cells on a grid that evolves through discrete time steps, according to a set of rules, based on the states of neighbouring cells.

The universe of Life is an infinite, 2D cellular automaton where each element (a square cell) is either dead or live (0 or 1). Every cell interacts with its eight neighbours. And at each tick, the following rules follow:

  1. Any live cell with two or three live neighbours survives.
  2. Any dead cell with three live neighbours becomes a live cell.
  3. All other cells die or stay dead.

The Universe

Let's build this block by block.

Firstly, we need an infinite, two-dimensional orthogonal grid of square cells to contain our population. Unfortunately, my system can't simulate infinity, so ours will be a bounded m x n grid as you see here:

https://imgur.com/qM224AP.png

This is a random seed. A red cell indicates Live. Meanwhile, all other cells are Dead.

Genesis

Any live cell with two or three live neighbours survives. Any dead cell with three live neighbours becomes a live cell.

If we simulate the next generation (iteration) basis the above rules, we can enumerate all the cells that will be Live in the next iteration (Interim Live):

https://imgur.com/KIktW3q.png

Death

All other cells die or stay dead.

To complete the tick (phase iteration), we also need to assess all the cells that will be Dead by the next tick (Interim Dead):

https://imgur.com/XRsDykb.png