07.07.08

Conway’s life in javascript

Posted in Web authoring, scripting, javascript at 6:15 pm by karl

I was playing with my computer last night and wrote a super-simple version of Conway’s Game of Life in javascript. Here’s how it looks.

Use the step button to advance a single generation, or use start/stop to run it as an animation. There are 2 classes in use here: life and lifeViewer. The life class does all the computing relating to Conway’s game, and lifeViewer displays it on the screen (using prototype for DOM manipulation and events).