I don't know where to start

Joined
Jul 17, 2010
Messages
1
Reaction score
0
I have the project due next Thursday, but I don't know where to start.
Is there anyone who can help me out?
-------------------------------------------------------------------------------------------------
Introduction

Write a C++ program that displays the evolution of the life housed in a two-dimensional array, 20 characters wide by 10 characters high, according to the rules invented by the mathematician John Horton Conway for the "Game of Life." You program should obtain its input from the file named config.txt. The input file will provide the number of generations to examine and print, as well as the initial status of life, i.e. generation 0. The program will display all the generations to the screen according to the sample interface given below. Use an * to represent a living cell, and use a blank to represent an empty (or dead) cell.

A sample config.txt file is provided as reference. The result printed to the screen for this config.txt file is also provided.

Sample Command Line Interface (For a 2 generation time span )
The Game of Life
Generation 0:

*
*
***






Generation 1:


* *
**
*





Generation 2:


*
* *
**





The Game of Life (Excerpted from Savitch's Absolute C++ pp. 227-228)

The "Game of Life" invented by the mathematician John Horton Conway, is not a game as much as it is an examination of interesting behavior governed by a few rules. Life is an organism that lives in a discrete, two-dimensional world. The world is an array with each cell capable of holding one life cell. Generations mark the passage of time, with each generation bringing births and deaths according to the following rules.

We define each cell to have eight neighbor cells. The neighbors of a cell are the cells directly above, below, to the right, to the left, diagonally above to the right and left, and diagonally below, to the right and left.
If an occupied cell has zero or one neighbor, it dies of loneliness. If an occupied cell has more than three neighbors, it dies of overcrowding..
If an empty cell has exactly three occupied neighbor cells, there is a birth of a new cell to replace the empty cell.
Births and deaths are instantaneous and occur at the change of generations. A cell dying for whatever reason may help cause a birth, but a newborn cell cannot resurrect a cell that is dying, nor will a cell's death prevent the death of another.

I need to work on a code as well as the pseudocode.
Please let me have some idea where to start and what to do.

--------------------sample config text file-------------------------------
3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
--------------------------------------------------------------------------------------the result printed to the screen--------------------------------
The Game of Life
Generation 0:

*
*
***






Generation 1:


* *
**
*





Generation 2:


*
* *
**





Generation 3:


*
**
**





--------------------------------------------------------------------------
Thanks for reading it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top