Spreadsheet Games: The Game of Life

When I asked people to send examples of interesting things they were doing with spreadsheets, Peter Burke sent this example of John Conway’s Game of Life simulator, programmed in Excel.

GameLife01

Peter, who’s from Glasgow, Scotland, explained how his program came about:

We hold coding dojo’s (http://codingdojo.org/cgi-bin/wiki.pl?WhatIsCodingDojo ) and one of the subjects was coding a game of life simulator.. needless to say, my excel offering was the only working version at the end of the two hours…

The Game of Life Rules

The Game of Life is based on a starting pattern in a grid, where every cell has 8 neighbours. From that initial pattern, the game progresses in steps. The rules are simple — at each step in the game:

  1. A live cell stays alive if it has 2 or 3 live neighbours, otherwise it dies.
  2. A dead cell comes to life if it has exactly 3 live neighbours, otherwise it stays dead.

How the Game of Life Simulator Works

In Peter’s version of the Game of Life simulator, you can start fresh, by clicking the “All Dead” button. Then, create your own starting pattern, by selecting from the drop down lists in the grid, to make cells Live (L) or Dead (D).

There are also a couple of preset starting patterns, and you can add those by clicking “Create Glider” or “Create Spaceship”.

You can adjust the maximum number of steps, and the wait time between steps.

Then, click the “Step Thru” button, to start the game, and click Stop, or let the game run its course. You’ll see the current step number at the top of the worksheet, in cell Q2.

GameLife02

Download the Game of Life Sample Excel File

You can download Peter’s Game of Life file, and experiment with your own starting patterns. The file is zipped, and in Excel 2003 format. It has macros, so you’ll have to enable them to test the game.

I made one minor tweak to Peter’s code, by removing a “Select” statement, so the game would be a bit less jumpy.

How Do You Use Spreadsheets?

What unusual spreadsheet applications have you created? If you have something you can share, please let me know!

________________

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.