Previous TopicNext Topic
Previous PageNext Page
   Conway's Game of Life
         A classic math game in Flash



I've always liked John Conway's Game of Life, a classic math experiment that demonstrates that a simple system can give rise to surprisingly complex results.

The rules are simple: on a square grid like a big chessboard, each square can hold either a living 'cell', or nothing. A giant metronome ticks, and at each tick, every cell with exactly two or three living cells among its eight neighboring squares will survive; an empty square with exactly three living neighbors will spawn a new cell, and all other living cells will die. The babies grow up fast, and at the next tick it all happens again.

The results vary wildly depending on the initial configuration. One pattern of five cells glides across the grid, wriggling like a tadpole; another expands into an oscillating flower; another spawns a roiling storm of chaos.

Implementing this "cellular automaton" as a web applet is nothing new. There are probably thousands, if not millions, of implementations. But I recently saw a very clever one by Patrick Mineault. Instead of churning through the whole grid of cells in a big slow ActionScript loop, he hands off the problem of counting up neighbors to an image convolution filter. That lets the Flash player - maybe even the graphics hardware - do the work, instead of ActionScript.

That's so clever I just had to try it out for myself. Patrick's version has some nice bells and whistles, but mine is just the basic Game:


By request, here is the source code:


<<< Who is Double Cat? <<< --- Dan Efran Gallery --- >>> XIcehouse >>>

Villa Infinity Copyright ©1999-2008 by Daniel S. Efran. All rights reserved.
Last update for this page: 17 January 2008
Send comments to embassy@efran.org