Canvas game of life with color
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This project is simply an implementation of Conway's Game of Life in coffeescript for the HTML canvas element. My goal was to make the code as easy-to-understand as possible. I tried to do this with semantically organized classes, as follows:

A Field is a 2d-array of Cells.
A Cell is a Neighborhood, some Effects, and a Billboard.
A Neighborhood is a set of references to eight nearby Cells.
An Effect is protected state which generates a Color for each frame depending on the state of the other Effects in the surrounding Neighborhood.
A Billboard is a rectangle that is repeatedly drawn on an HTML canvas in a certain Color.
A Color is some amount of alpha, red, green, and blue.

The program initializes a Field of Cells then repeatedly calculates the changes in Effects to each of those Cells, displaying the resulting Colors on Billboards using an HTML canvas.