Game of life help


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 1 of 1

Thread: Game of life help

  1. #1
    Join Date
    Feb 2006
    Posts
    4

    Game of life help

    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();
    }
    }
    Last edited by kyle_charest; 02-13-2006 at 08:51 AM.

Similar Threads

  1. Game Help (Game to be made in VB)
    By aamsaf in forum VB Classic
    Replies: 0
    Last Post: 09-14-2005, 03:19 PM
  2. Replies: 3
    Last Post: 03-09-2005, 12:24 AM
  3. Replies: 0
    Last Post: 03-07-2002, 04:53 AM
  4. Framework of a complex game...
    By AGuy in forum Java
    Replies: 0
    Last Post: 07-31-2000, 08:35 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center