A javascript implementation of the Game of Life, http://en.wikipedia.org/wiki/Conway's_Game_of_Life.
var canvas = document.getElementById("theCanvas");
// Re-size the canvas to fit the whole screen. Do not use the JQuery selector here
// since we are changing the canvas's width and height not its css width and height.
canvas.width = $(".background").width();
canvas.height = $(".background").height();
var context = canvas.getContext("2d");
if (board == null)
{
board = new GameOfLife(context, {color: "blue"});
}
var rowStart = 6;
var colStart = 6;
board.createGliderGun(rowStart, colStart);
// Init a glider.
board.createGlider(rowStart*4, colStart*4);
board.start();