Conway’s Game of Life

We were looking at several implementations of Conway’s game of life, hoping to feature one, and this one in particular caught our eye because of the first sentence of its README: Geoff Hulette’s Game of Life

Two versions of Conway’s game of Life. One is a fairly standard version, the other is very slow, but specified in an interesting way.

We’ll save an exploration of what makes the slow second version interesting for another post. For now, we’ll talk just about how we made the art.

Building the package

Since the last commit to the repository was in October 2010, we had some concerns that it wouldn’t build at all, and indeed, the instructions included in the original README did not work for us. The main issue seemed to be problems with finding and resolving native dependencies for the graphics.

Since we use Nix – our main computers use NixOS and we have the Nix package manager installed even on our Ubuntu machine – a convenient way to solve this was to initialize Stack The Haskell Tool Stack as the project manager and enable Nix to handle the necessary dependencies.

We also rearranged the project structure a little to better fit our expectations of project organization, and we have pushed the resulting changes to our own repository Our fork of this game of life with updated project structure and installation instructions. along with updated installation instructions.


After we had the dependency issues resolved, we were pleased to find the project worked just fine with no further changes by us.

So then all we had to do was go in and work on finding colors we liked!

The colors are all indicated by GLfloat numbers and can be found in the Graphics module. GLfloat is a type synonym for Float used by the OpenGL package. Put three of them together, much like you would RGB values, and you get a color.

Once we added some new colors and added them to the export list for the Graphics module, we were varied the colors of the “alive” and “dead” cells in the Main module. Please note: you have to rebuild the program each time you change colors.

Join Type Classes for courses and projects to get you started and make you an expert in FP with Haskell.