ECE-1021

HOMEWORK #8

(Last Mod: 27 November 2010 21:38:41 )

ECE-1021 Home


PROGRAM A - The Game of Life

Programming Problem #6.18 (p300).

To write this program so that the display is meaningful, you will need to use the console control functions from <conio.h>.

MODIFICATIONS: There are many variants on the game of life, most having to do with the boundary conditions. The authors have given boundary conditions that state that the neighbors of an edge cell are only those cells immediately adjacent to it and therefore it has only five neighbors while corner cells only have three neighbors.

For a different set of boundary conditions, imagine taking a piece of graph paper and rolling it into a tube, now the side "edge" cells still have eight neighbors because the grid "wraps around". The top and bottom "edge" cells still only have five adjacent cells. Notice that there are no longer any corner cells.

One of the most common implementations of The Game of Life approximates a spherical world by having the left edge wrap around to the right and the bottom edge wrap around to the top. This way all cells have exactly eight neighbors. Write your program using these boundary conditions.

The larger the world, the more interesting the results. Write your program so that the user can enter the desired number of rows and columns up to a max area of 76x20. Your program should center the world on the screen and surround it by some kind of boarder (pipes hyphens work fine).

The program should also give the option of entering a specific random number seed or having the program choose one at random.

The program should all the user to control the display of the world as follows by hitting the following keys during the simulation (without hitting the ENTER key). This can be accomplished using the functions available in <conio.h>.

<P> : Pause the simulation

<G> : Go - continue the simulation

<Q> : Quit the simulation (but not the program)

<X> : Exit the program entirely

<J> : Jump to the generation entered by the User

<N>: Single Step to the next generation.

<+> : Increase the refresh rate (faster generations)

<-> : Decrease the refresh rate (slower generations)

<S> : Seed the random number generator with a new seed.

The program should use the next to last line to display the random number seed, the current generation number, and the game status (such as Paused/Jumping/Running/Stopped)