Click to See Complete Forum and Search --> : Game of life help


kyle_charest
02-09-2006, 10:12 PM
i have this assignment due monday, and i dont have any clue where to go next. im sure most of you are aware of the game of life. anyways i need to build it in C++ instead of the usual java. i am trying to make it with the multidimensional arrays, and i am getting lost. i am not sure where to ut teh rules, and i have given up on the randomization part of it. If you could give me any help or tips that would be great. either post or email it to me charesty@norwich.edu thanks--


//Life Project

#include <iostream>
#include <stdlib.h>
#include <cmath>
#include <cstdlib>
using namespace std;



int x, y, spots;
int life_spots [22][80];
void end();
void fill();
const int N = 21;
const int O = 79;
string answer;
int s, r, n, o;

int
main ()
{
life_spots[s][r] = 0;
for (s = 0; s < 80; s++ )
{
for (r = 0; r < 22; r++ )
{

}
}

fill ();
}

void fill ()
{

cout << "How many spots in the 22X80 Graph would you to populate?";
cin >> spots;

for (n=0; n < spots; n++)
{
cout << "Please enter the X coordinate followed by the Y Coordinate,";
cout << "\n";
cout << "with a space in between the two values:";
cin >> x >> y;
if (y > 80)
{
cout << "Error, number must be less than or equal to 80 for Y\n";
break;
}
if (x > 22)
{
cout << "Error, number must be less than or equal to 22 for X\n";
break;
}

}

system("pause");
end();
}




void
end()
{
cout << "Would you like to start over?\n";
cin >> answer;
if (answer == "yes")
{
main();
}
}