I’ve always wanted to have a go building Conway’s Game Of Life and thought it would be a perfect first subject for my first daily code hour. It went great and you can see the results running live below.
“The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John Horton Conway in 1970. It is a zero-player game, meaning that its evolution is determined by its initial state, requiring no further input.” (Wikipedia 🔗)
The game is played on an infinite 2D grid and on each generation or tick, every cell is tested against the following rules:
- Reproduction - Any dead cell with exactly three live neighbours comes to life
- Over-Population - Any live cell with more than three live neighbours dies
- Under-Population - Any live cell with fewer than two live neighbours dies
Just these three simple rules give a huge range of complex behaviour, including being Turing complete! I find it completely hypnotic.
The version playing above is started with random noise, if you reload the page you will get a new game.
This version is also slightly tweaked, I made a modification to the reproduction rule I’m calling the Life Finds A Way Variant. Reproduction still happens with three neighbours but there is a 1 in 10000 chance that it will also happen with only two neighbours. This change means this variant is not turing complete because of the added randomness, but it does mean the game doesn’t come to a stop and you can leave it running much longer which I felt would work well here.