Source Code for Game of Life

Last week I blogged about the Game of Life.

Well it took some searching through dead hard drives and old USB storage but I found the program I wrote, and better than that I have figured out how to turn it back into source code.

The file date is November 2004 and the source code has no comments so I don’t know what was going through my head when I wrote it, or even what some of it does.

To view the source code download Life.src, to download the finished program download Life.


I am actually surprised I was expected the code to be much worse than it was, I am not saying it is good, but I can see more than one method and I can’t see any code that obviously is repeated. I can see some terrible variable names. Note to future self don’t use tmp676_674!

Assuming that I wrote this in 2004 what would  I have been doing then? It was before I started working in IT. (Hard to imagine I know!) It may even have been before I started living with Keith, before he recruited me for my first IT role. I think I was probably working as an administrator for Defra at this point.

If we put 2004 in technical terms, it was before I joined facebook, Office 2003 and XP would have been installed on my PC, and probably felt brand new.

Game of Life

Many, many years ago I tried to learn Java. I didn’t get very far but one of the things I built was The Game of Life.

Unfortunately I can not find the code I wrote, probably a good things as it is probably amusingly bad.

Now you are probably asking what is the Game of Life? The game of life, sometimes called cellular automation, is a simulation of cells being born and dying. It is sometimes called Conway’s Game of Life after the British mathematician who devised it in 1970.

The game has several rules:

  1. Any cell with less than three neighbours will die on the next turn
  2. Any cell with three neighbours lives on to the next turn
  3. Any cell with more than three neighbours will die on the next turn
  4. Any dead cell with three live neighbours will be born on the next turn

Now I had not thought about this game until the other day when I came across a blog and a github page which sparked my interest again. This version is written in javascript, but the blog mentions a desire to build this program in many different languages. I want to build this with visual studio in c sharp as it should provide a good training exercise.

There are several problems I need to overcome to achieve this, I am currently trying to work out how to “draw” the cells. My current thinking is that maybe I can code it using characters to display the cells and then replace with pixels once I have the logic correct. Well lots for me to learn!