These are projects posted by the students of Dr. Gove Allen at Brigham Young University. These students have taken one semester-long course on VBA and generally have had no prior programming experience

Wednesday, April 13, 2011

Conway's Game of Life for Excel

Conway’s Game of Life for Excel (CGoLfE) is an excel program that plays Conway’s Game of Life using Excel cells for input and output. Conway’s Game of Life was written by John Conway to be a cellular automation model. The game is played on a two-dimensional grid, which makes Excel a good candidate for a Game of Life client. Each individual cell can be in either one of two states: alive or dead. The game has turns or “generations”; in between each generation it is decided if each individual cell will be alive or dead in the next generation -- this process is called a step. The game follows the following rules (taken from Wikipedia):

1. Any live cell with fewer than two live neighbors dies, as if caused by under-population.

2. Any live cell with two or three live neighbors lives on to the next generation.

3. Any live cell with more than three live neighbors dies, as if by overcrowding.

4. Any dead cell with exactly three live neighbors becomes a live cell, as if by reproduction.

The game only needs the initial state as input, but it is possible to change the state of each cell after the first step has occurred. CGoLfE includes an Excel sheet that acts as the input/output grid and a user form which controls the progress of the game. The user form allows a user to reset the form, resizing all cells to the normal size and resetting all cells to the dead state. The user form allows a user to randomize the state of each cell, this will randomly choose the state of the cell, giving a 1:3 chance to be alive and 2:3 chance to be dead. The user form also allows the user to make a single step through the game. The user form also allows the user to step continuously through the game until the process is cancelled. The user form also allows the user to choose between three interesting preset starting states. At any time the user can double click on a cell to change the cell’s state.

No comments:

Post a Comment

Blog Archive