Conway’s Game of Life

I thought I should talk a little about the project I’m focusing on right now. I’m still spinning up on XNA, and I was reading an article somewhere recently that mentioned Conway’s Game of Life. I was never taught about this in school for some reason. What a wonderful little thing!

Anyways, I thought it would be fun to implement Conway’s Game of Life in XNA to give myself something tangible (in the software sense… what does that really mean, anyways?) to work on. I’ve already got a basic architecture done, but I want to write down some of the guidelines I’m trying to stick to. Just basic stuff, like:

What am I trying to learn?
- I want to learn about what it will take to implement a menu system in XNA.
- I want to learn about mouse interaction with an object (the game board) on the screen.

Which Game of Life algorithm should I use?
- a few are mentioned on the wiki page, notably hashlife. Since I’m not trying to learn about Game of Life specifics, I’m going to start with brute force with two 2d arrays (one for the current interation, and one for the next). It will give me a good quick start on my goal, and also give me a good baseline if I decide to optimize the algorithm.

What operations should I allow?
- a mouse click should turn a cell on or off. Hold and drag to fill or unfill cells under the mouse pointer
- spacebar should step to the next iteration.
- enter should run through iterations at the chosen speed (we’ll need a menu for that).

What should the menu contain?
- Options
– run speed
– window size
– colors?
- I’ll leave any other nifty stuff for later.

Things that would be very interesting to implement:
- the ability to move and zoom the camera around the grid with the mouse or keyboard
- some logic to move and zoom the camera automatically, and follow the most activity in the grid. One nasty corner case for this is any gliders that come off of the high activity areas. how do i know when to ignore them?

More to come later when I have more of this implemented.

Leave a Reply