Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string config = "config.txt";
- string creature = "creature.txt";
- ifstream configin;
- ifstream creaturein;
- int type = 0;
- configin.open(config.c_str());
- creaturein.open(creature.c_str());
- int choice = 0;int WIDTH = 0; int HEIGHT = 0;
- bool torus;
- HANDLE hOut;
- hOut = GetStdHandle(STD_OUTPUT_HANDLE);
- SetConsoleTextAttribute(hOut, FOREGROUND_RED | FOREGROUND_INTENSITY);
- cout << " WELCOME TO LARRY'S GAME OF LIFE! \n\n\n";
- SetConsoleTextAttribute(hOut, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- cout << " What would you like to do for board config? \n"
- << "1. - By Default\n"
- << "2. - Configure Board \n";
- cin >> choice;
- if (choice == 2)
- {
- SetConsoleTextAttribute(hOut, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
- cout << "\nBoard Size( Width By Height): ";
- cin >> WIDTH >> HEIGHT;
- cout << "\nWould you like it to be a torus?: (1 for true or 0 for false)";
- cin >> torus;
- }
- system ("cls");
- SetConsoleTextAttribute(hOut, FOREGROUND_BLUE | FOREGROUND_INTENSITY);
- if (WIDTH == 0){
- configin >> WIDTH >> HEIGHT >> torus;
- }
- plane *myplane = new plane(WIDTH,HEIGHT,torus);
- cout << "What would you like to do for the Organisms\n"
- << "1. - Default\n"
- << "2. - Configure Manually\n";
- cin >> choice;
- int x = 0;
- int y = 0;
- if (choice == 2)
- {
- SetConsoleTextAttribute(hOut, FOREGROUND_GREEN | FOREGROUND_INTENSITY);
- cout << "\nPlease Enter X and Y Coordinates for Producers (enter -1 to exit Producer)\n";
- while (x != -1)
- {
- cin >> x >> y;
- myplane->addOrg(x,y,1);
- cout << endl;
- }
- cout << "\nPlease Enter X and Y Coordinates for Consumers (enter -2 to exit Consumer)\n";
- while (x != -2)
- {
- cin >> x >> y;
- myplane->addOrg(x,y,2);
- cout << endl;
- }
- system ("cls");
- }
- else
- {
- creaturein >> x >> y >> type;
- x = x-1;y = y-1;
- while (creaturein.good())
- {
- myplane->addOrg(x,y,type);
- creaturein >> x >> y >> type;
- x--;y--;
- }
- system ("cls");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement