I thought it would be fun to implement Conway’s Game Of Life. I used ColdFusion a bit in my example to ease some typing but the “engine” is all JavaScript. Beloved Prototype is also being used a bit behind the scenes.
So without further ado, here’s a
// set up a game of size 30 x 30
g = new Game_Of_Life(30);
// set some random tiles, note that you
// have way more of these for a size
// 30 board.
g.set_tile(2,26,1);
g.set_tile(19,20,1);
// draw inital board
g.draw();
// run the game, 1/25s "frame-rate"
g.run(.25);
And, as always: Download the code!
PS: It looks like terrible in Internet Explorer. No comment.