Programming C++  «Prev  Next»
Lesson 4 Course project
Objective General specifications of course project.

C++ Course Project

The general specifications of the course project.

The skills you gain in this course will be put to the test in the course project. You will be building a life simulation program that prints out a grid of randomly generated cells that become alive, stay alive, or become empty depending on a set of rules.
The program uses a dynamically generated two-dimensional array to store information about and display the cells. Each cell on the "life board" is either empty or alive.
There are a number of ways to display whether a cell is alive or empty. A common way is to have 1's represent cells that are alive and 0's represent empty cells:

0 0 0 0 0 0 0 0 0 0
0 1 1 0 0 1 0 1 0 0
0 0 0 1 0 1 0 0 1 0
0 1 1 0 1 0 1 0 0 0
0 0 1 0 1 0 0 0 0 0
0 1 0 1 0 1 1 1 0 0
0 1 1 1 1 1 0 0 0 0
0 1 0 1 0 1 0 0 0 0
0 0 0 0 1 1 1 1 0 0
0 0 0 0 0 0 0 0 0 0
At each cycle, a cell either becomes alive, stays alive, or becomes empty depending on how many neighbors it has. By displaying the board at each cycle or at periodic times during the lifetime of the board, you can see how the pattern of life varies.
While this program is the final project for this course, it serves as the basis for the course projects in the next two courses in the C++ for C Programmers series, culminating in a predator/prey simulation in the final course of the series.