Conway's Game of Life

23 Dec 2009 | By Alex Young | Tags compsci fun

Our recent post about Processing.js made me think about Conway’s Game of Life. If you haven’t come across it before, it’s a simulation that works like this:

1. Any live cell with fewer than two live neighbours dies, as if caused by underpopulation.
2. Any live cell with more than three live neighbours dies, as if by overcrowding.
3. Any live cell with two or three live neighbours lives on to the next generation.
4. Any dead cell with exactly three live neighbours becomes a live cell.

I like to use this algorithm to experiment with new graphics libraries, so I had my own Processing version from back in 2005. I’ve ported it to Processing.js here conway-js.

I’ve also found lots of interesting pure JavaScript implementations. ConwayJS by Joseph Robert is my favourite. It’s pretty fast and allows you to draw cells with the mouse.

Another interesting one is game_of_life by sukhchander.

I’ve uploaded my Processing.js examples to DailyJS so you can see them without checking out the git repositories:


blog comments powered by Disqus