Conway’s Game of Life

I realized one day that I had never implemented Conway’s Game of Life, which is something of a rite of passage for young computer-science students. As I opted for a more non-traditional path to the software profession, I somehow missed that fun, even though I’ve made a point of implementing other computer-sciency things like it.

While the game itself is actually quite simple (look at the generation method in the source code to see just how simple), the notion of implementing it on a self-contained web page and making it as fast as possible seemed intriguing, so I dived in. About six hours later I had it pretty much finished. Optimizing it took one more day several more days as new optimizations occurred to me.

The “Step” button will let you move forward one generation at a time to watch how the cells interact with each other. The link labeled “Link to current board state” will let you save a link to the cellular configuration that you see at any given time.

Live cells:
Generation time (ms):

Settings (Click “Stop” to Edit, “Start” to Activate)

More Patterns

Here are a few links to some interesting boards:

A Gosper glider gun

A Gosper glider gun running at top speed, probably faster than your screen’s refresh rate.

A set of cells that devolves into a single spinner.

A pair of gliders which follow each other endlessly.

A large board with a long-running pattern

Stand-alone Page

If you’d like to examine the source without all the WordPress clutter or download the page to play with on your own system, you can take a look at the stand-alone page that implements the same code.


Leave a Reply

Your email address will not be published. Required fields are marked *