Conway’s Game of Life variations

This is a three-part post about Conway’s Game of Life and some easy-to-implement  variations that can lead to interesting visual results.

  • Part 1: adding colors
  • Part 2: extending the neighbourhood [… coming soon …]
  • Part 3: moving to the third dimension [… coming soon …]

Part 1: adding colors

The Conway’s Game of Life is a cellular automaton created by the British mathematician John Horton Conway in 1970. It is a theoretically infinite grid of cells; each cell can be in two states: dead ($0$) or alive ($1$). Initially the grid has a particular initial configuration  (for example a percentage of the cells are set to alive).  Then the cells evolve, and the state of cell $(x,y)$ at generation $N+1$ depends only on its state and the state of its eight neighbours at generation $N$. The rules are simple:

  • if a dead cell at generation $N$ is surrounded exactly by 3 alive cells then it willl be alive at generation $N+1$
  • if an alive cell at generation $N$ is surrounded by  2 or 3 alive cells, then it will stay alive, otherwise it will become a dead cell at generation $N+1$

Despite the simple rules, the Conway’s Game of Life is a Turing Complete model of computation (i.e. it can simulate any computer).

The visual configurations and the animations are also visually interesting.

A first variant can be obtained in the following way:

  • overlap three independent cell grids (one for each component Red-Green-Blue)
  • animate each grid using the standard rules, but for each cell $(x,y)$ in each grid also keep a fractional (float) value $C(x,y)$ in the range (0,1) ($C_r$ for the red grid, $C_g$ for the green grid, $C_b$ for the blue grid) and update it using the following rules:
    • if a cell becomes alive then add a fixed constant $v_1$ to it: $$C(x,y) = C(x,y)+v_1$$
    • if a cell becomes dead then subtract a fixed constant $v_0$ to it: $$C(x,y) = C(x,y) – v_0$$
  • render each cell $(x,y)$ with a square (or pixel) and color it according to the three RGB components values $C_r, C_g, C_b$ that it has in the three independent grids: $Red = C_r(x,y)*255$, $Green=C_g(x,y)*255$ , $Blue=C_b(x,y)*255$

This is a video that shows the resulting animation made with Processing 3 using $v_1=0.3$, $v_0=0.04$, starting from an initial random configuration:

The Processing source code can be downloaded here:

https://www.algoritmarte.com/vdisk/code/ColoredLife.zip