3D Conway's Game of Life

...in Python (Pyglet + OpenGL)...

From the Weekend Programming Challenge

Conway's Game of Life is a cellular automaton devised by British mathematician John Horton Conway in 1970. Only a few rules result in a stunningly wide range of results - most patterns grow and change for a substantial period of time eventually entering into a stabilised state.

The rules are quite simple, and in some (admittedly artificial) way mirror real lifeforms.

  1. Any live cell with fewer than two live neighbours dies.
  2. Any live cell with more than three live neighbours dies.
  3. Any live cell with two or three live neighbours survives.
  4. Any dead cell with exactly three live neighbours becomes a live cell.
These rules mimick lifeforms, being affected by overcrowding (lack of resources) and "expansion" from surrounding cells. Due to the reliance on new cells having some connection to old cells, each and every step of life in Conway's Game relies on being connected to an older cell. For this reason I thought it interesting to visualise the progression of the pattern over time, as if a building or termite colony constructing itself layer by layer.

Limitations and Future Ideas

The Source

The source code is two files, conway.py which handles the pattern generation and viewer.py which makes Conway's Game into a three dimensional grid. If you make any improvements I'd love to hear about them!

Download conway3d-0.1.tar.gz