DEV Community

Simon Foster
Simon Foster

Posted on • Originally published at funkysi1701.com on

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# 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!

Top comments (0)