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.
- Any live cell with fewer than two live neighbours dies.
- Any live cell with more than three live neighbours dies.
- Any live cell with two or three live neighbours survives.
- Any dead cell with exactly three live neighbours becomes a live cell.
Limitations and Future Ideas
- Currently the layer generation is tied to the FPS - meaning an increase in FPS also results in an increase in the speed of the simulation.
- The OpenGL layer creation could be optimized, but the performance at this point is sufficient even on older machines.
- Fullscreen looks amazing - it'd be awesome to have this as a screensaver =]
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!