Conway's Game of Life

Read more

What I learned coding Conway's Game of Life

The idea

Conway's Game of Life is a cellular automaton, a grid of cells, each with a limited number of states (two in this case) and predictable rules for changing between those states. In the Game of Life, any live cell (in colour above) where two or three of its eight immediate neighbours are also alive stays alive, else it dies; any dead cell with precisely three live neighbours comes alive.

My version

I wanted to implement a version of the game to learn the basics of HTML5 Canvas. Instead of the usual two-tone aesthetic, I thought it would be interesting to bring in a splash of colour. A natural option was for the colour to represent how long live cells had been alive for. The grid is 100x100 cells with a solid border.

Methuselahs and Spaceships and what now?

Over the years, many different initial configurations of live cells have been studied and explored in Game of Life. The dropdown above allow you to place what I consider to be some of the most interesting of these in the grid as a whole, instead of cell by cell. Methuselahs are patterns with a small number of initial live cells which take an unexpectedly long time to stabilise. Spaceships are patterns which move across the grid over time.