HI everyone,,,i am a beginner in c++ & i have an a assignment that i cant even start & i need in advice that i can get so plzzzzzzz help,,, the assignment is about a game

The Predator‐Prey game is a simple board game where a set of predators and preys move freely across
the board. The goal of the game is that predators eat all the preys available.
The following is a description of the game rules:
 Predators and preys move on a 2‐dimensional closed grid of size 12x12 cells. Predators and preys
are not allowed to move outside the grid.
 There are two kinds of predators: snakes, and scorpions. On the other hand, there are three kinds of
preys: bugs, ants, and worms.
 Scorpions eat bugs and ants but not worms, while snakes eat worms and bugs but not ants.
 The game consists of successive turns. During one turn, each of the creatures moves one step into
one of the adjacent cells (up, down, left, or right). If there is no empty adjacent cell, the creature
stays in its place during this turn.
 Predators’ movements are controlled by the user, while preys move randomly.
 Each turn starts by prompting the user to move each of the predators, then the preys take their turn
and each of them moves one random step.
 A predator breeds if it survives for 24 moves, while a prey breeds if it survives for 12 turns. The new
offspring is of the same type, and is added into one of the adjacent cells (top, bottom, left, or right).
Naturally, if there is no empty adjacent cell no breeding takes place.
 A predator eats a prey if it is in one of the predator’s adjacent cells (top, bottom, left, or right) and is
of the proper type.
 A predator starves and dies if it moves 12 turns without eating a prey.
Your program should display the game board along with the current creatures. Use the characters ‘S’ for
snakes, ‘X’ for scorpions, ‘B’ for bugs, ‘A’ for ants, and ‘W’ for worms.
Initialize your game board with 1 snake, 1 scorpion, 12 ants, 12 worms, and 12 bugs. Place them in
random locations.

i need any help concerning the syntax or an idea that i can use,,,,i.e: the game is prefered to be made using OOP concepts(object oriented programming)

No one is going to design this for you since you don't show us that you have made any effort at all to think about the problem (other than how to write your question and copy/paste the problem description).

You know that you want to use OOP concepts to write this game... so start thinking: What kind of objects do you have in this game? Do any of the object have anything in common? Which objects interact with eachother? By asking yourself those kind of questions you can decide about a design.

So start thinking and ask _specific_ questions here if there is something that you do not understand, or you would like to discuss a design approach that you made.

at first thx,,,,but u must know something that i know alittle about OOP by reading about it through the internet,,,i have learned about classes & struct & i have known about constructors destructors getters & setters & i can use them but what i cant use & i need 2 learn more about & need more help to understand it is virtual functions & copy constructors & friend function & parent child class,,,& all of this i think that have to use in this assignment,,,so what i have asked for is help in explaining such things so i can build up my code & connect it together.
i.e to me the OOP is a new thing that i dnt know anything about & my instructor gave me this assignmet as a self learning assignment thats why i need help

There is a lot of information available on the internet that explain virtual functions and all the others things you mention much better than I would be able to explain in a post here.

But what I said before is still true to start with.. ask yourself the questions I mentioned, especially about which classes have information in common.

If you think that some of the classes have something in common, you can put this information in a 'base class' and let all the other classes that need this information inherit from the base class.

Take for example a car and a bus. They both have wheels, the both have an engine etc.
So you could create a base class 'vehicle' that contains information about wheels and engines and let the car and bus classes inherit from vehicle:

class vehicle
{
   int m_NumBerOfWheels;
   int m_HorsePower;
};

class car : public vehicle
{
   car() { // we can use m_HorsePower etc. here }
};

I ommitted the constructor/destructor and public/private modifiers but u get the idea...
Now every vehicle needs a way to start, but let's assume that a car and a bus start in a different way, this is where you could use virtual functions:

class vehicle
{
   virtual bool start()  // Default start() function
   {
       cout << "vehicle starting\n";
   }
   virtual bool stop() = 0; // PURE virtual function, means every class that inherits from vehicle MUST implement it
};

class car : public vehicle
{
// Note: we MUST implement stop because it is a pure virtual, but car will use the 'default' start function of vehicle
   bool stop() { cout << "Car stopping\n"; }
};

class bus : public vehicle
{
    bool start() { cout << "bus starting\n"; }
    bool stop()  { cout << "bus stopping\n"; }
};

//Now you can write code like:   
int main()
{
   vehicle* vehicle1 = new car();
   vehicle* vehicle2 = new bus();

   vehicle1.start(); // prints: "Vehicle starting"
   vehicle2.start(); // prints: "bus starting"
   vehicle1.stop();  // prints: "car stopping"
   vehicle2.stop();  // prints: "bus stopping"

   delete vehicle1;
   delete vehicle2;
}

Hmm I said I wouldn't explain but I guess I just did

thx,,,now i can know how to make a class inherit from the other & here is the code i have written till now,,,& in this code i cant make a display of a charcter in the border

// Snake !!!.cpp : Defines the entry point for the console application.
//


#include <iostream>

using namespace std;


class Critter
{protected:
        int  x;
        int  y;
        char z;

 public:
 Critter();
          void setx(int x)
        {
           this->x = x[i];
        };
        void sety(int y)
        {
            this->y =y[j];
        };
        void setz(char z){
            this->z = z;
        };
        int getx(){
            return x;
        };
        int gety(){
            return y;
        };
        char getz(){
            return z;
        };

        void display()
        {
            cout<<x<<endl;
            cout<<y<<endl;
            cout<<z<<endl;
                    };
        void move();
        void breed();
        void starve();

};
Critter::Critter()
{
    x = 0;
    y = 0;
    z = 'a';
};

/*class Predator : public Critter
{


};

class Prey : public Critter
{



};*/



int main()
{

    char board [20][20];
    for (int j=0; j<20; j++)
    {
       board[0][j]  = '@';
       board[19][j] = '@';
    }

    for (int i=0; i<20; i++)
    {
       board[i][0]  = '@';
       board[i][19] = '@';
    }


    for (int j=1; j<19; j++)
    {
        for (int i=1; i<19; i++)
        {
            board[i][j] = 0;
        }
        cout<<endl;
    }

    for (int i=0; i<20; i++)
    {
        for (int j=0; j<20; j++)
        {
            cout<< board[i][j];
        }
        cout<<endl;
    }

    Critter c;
    c.setx([5]);
    c.sety([5]);
    c.setz('A');
    c.display();

return 0;
}

so this the code i have reached till now & i have discovered what i have done wrongly conerning my last question,,,,,now i want to know how to make what i have displayed move once move randomly & the other time move by using keyboard arrows

#include <iostream>
#include <conio.h>
#include <windows.h>
using namespace std;

char board[20][20];

void setBoard ()
{
    for (int j=0; j<20; j++)
            {
               board[0][j]  = 219;
               board[19][j] = 219;
            }

            for (int i=0; i<20; i++)
            {
               board[i][0]  = 219;
               board[i][19] = 219;
            }
            for (int j=1; j<19; j++)
            {
                for (int i=1; i<19; i++)
                {
                    board[i][j] = ' ';
                }
            }
}

void displayBoard()
{
    for (int i=0; i<20; i++)
    {
        for (int j=0; j<20; j++)
        {
            cout<< board[i][j];
        }
        cout<<endl;
    }
}

struct objects
{
    int  x_coord;
    int  y_coord;
    char z_dep  ;
    int  counter;
};


class Scorpion
{
 private:
    int  x_x;
    int  x_y;
    char x_z;
    int  x_c;
    int count1;
    int flag1;

 public:
    objects scorpionz [200];
    Scorpion()
    {
        count1 = 0;
        flag1  = 0;
        for (int i=0; i<200; i++)
        {
            scorpionz[i].x_coord =  0 ;
            scorpionz[i].y_coord =  0 ;
            scorpionz[i].z_dep   = ' ';
            scorpionz[i].counter =  0 ;
        }
    }

    int getXX(int index1)
    {
        return scorpionz[index1].x_coord;
    }

    int getXY(int index1)
    {
        return scorpionz[index1].y_coord;
    }

    int getXC(int index1)
    {
        return scorpionz[index1].counter;
    }

    void setArray (int l, int m, char n, int index1, int cntr)
    {
        scorpionz[index1].x_coord =  l  ;
        scorpionz[index1].y_coord =  m  ;
        scorpionz[index1].z_dep   =  n  ;
        scorpionz[index1].counter = cntr;
    }

    int move (int x_x, int x_y, int index2, int x_c)
    {
        int g = 1;
        int h = 1;
        g = getch();
        h = getch();

        x_x = scorpionz[index2].x_coord;
        x_y = scorpionz[index2].y_coord;
        x_z = scorpionz[index2].z_dep  ;
        x_c = scorpionz[index2].counter;

        if( h == 27 )
        {
            system ("CLS");
            cout<<endl<<endl<<"\n"<<"\n"<<"\n";
            cout<< "                           Thank You For Playing!"<<endl<<endl<<endl<<endl;
            cout<<endl<<endl<<endl<<endl<<endl<<endl;
            exit(1);
        }

        if( h == 72 )
        {
            if(x_x > 1)
            {
                moveUp(x_x, x_y, index2, x_c);
                flag1 = 1;
                count1++;
                return 1;
            }
        }

        if( h == 80 )
        {
            if(x_x < 18)
            {
                moveDown(x_x, x_y, index2, x_c);
                flag1 = 2;
                count1++;
                return 2;
            }
        }
        if( h == 77)
        {
            if(x_y < 18)
            {
                moveRight(x_x, x_y, index2, x_c);
                flag1 = 3;
                count1++;
                return 3;
            }
        }
        if( h == 75 )
        {
            if(x_y > 1)
            {
                moveLeft(x_x, x_y, index2, x_c);
                flag1 = 4;
                count1++;
                return 4;
            }

        }
        return 0;
    }

    void moveUp( int x_x, int x_y, int index2, int x_c)
    {
        if(/*(board[x_x-1][x_y] == ' ' || board[x_x-1][x_y] == Bugs || board[x_x-1][x_y] == Ants) &&*/ board[x_x-1][x_y] != 12 && board[x_x-1][x_y] != 23)
        {
            board[x_x][x_y] = ' ';
            x_c = x_c + 1;
            setArray ((x_x-1), x_y, 12, index2, x_c);
            board[x_x-1][x_y] = 12;
            x_x = x_x - 1;
            //delete Bug or Ant object in array
        }
        else
        {
            x_c = x_c + 1;
            setArray (x_x, (x_y), 12, index2, x_c);
            board[x_x][x_y] = 12;
        }
    }

    void moveDown( int x_x, int x_y, int index2, int x_c)
    {
        if(board[x_x+1][x_y] != 12 && board[x_x+1][x_y] != 23)
        {
            board[x_x][x_y] = ' ';
            x_c = x_c + 1;
            setArray ((x_x+1), x_y, 12, index2, x_c);
            board[x_x+1][x_y] = 12;
            x_x = x_x + 1;
            //delete Bug or Ant object in array
        }
        else
        {
            x_c = x_c + 1;
            setArray (x_x, (x_y), 12, index2, x_c);
            board[x_x][x_y] = 12;
        }
    }

    void moveRight( int x_x, int x_y, int index2, int x_c)
    {
        if(board[x_x][x_y+1] != 12 && board[x_x][x_y+1] != 23)
        {
            board[x_x][x_y] = ' ';
            x_c = x_c + 1;
            setArray (x_x, (x_y+1), 12, index2, x_c);
            board[x_x][x_y+1] = 12;
            x_y = x_y + 1;
            //delete Bug or Ant object in array
        }
        else
        {
            x_c = x_c + 1;
            setArray (x_x, (x_y), 12, index2, x_c);
            board[x_x][x_y] = 12;
        }

    }

    void moveLeft( int x_x, int x_y, int index2, int x_c)
    {
        if(board[x_x][x_y-1] != 12 && board[x_x][x_y-1] != 23)
        {
            board[x_x][x_y] = ' ';
            x_c = x_c + 1;
            setArray (x_x, (x_y-1), 12, index2, x_c);
            board[x_x][x_y-1] = 12;
            x_y = x_y - 1;
            //delete Bug or Ant object in array
        }
        else
        {
            x_c = x_c + 1;
            setArray (x_x, (x_y), 12, index2, x_c);
            board[x_x][x_y] = 12;
        }
    }

    void die (int x_x, int x_y, int index1, int counter)
    {

        x_x     = scorpionz[index1].x_coord;
        x_y     = scorpionz[index1].y_coord;
        counter = scorpionz[index1].counter;

        if( scorpionz[index1].counter == 6 )
        {
            setArray ( 0 , 0 , ' ' , index1, 0);
            board[x_x][x_y] = ' ';
        }
    }


    void breed(int x_x, int x_y, int index1, int x_c)
    {
        if( scorpionz[index1].counter % 12 == 0 )
        {
            x_x = scorpionz[index1].x_coord;
            x_y = scorpionz[index1].y_coord;
            x_c = scorpionz[index1].counter;

            int t;

            for(int j=0; j<200; j++)
            {
                if(scorpionz[j].x_coord == 0)
                {
                    t = j;
                    break;
                }
            }
            if(board[x_x+1][x_y] == ' ' )
            {
                x_x = x_x + 1;
                scorpionz[t].x_coord = x_x;
                scorpionz[t].y_coord = x_y;
                scorpionz[t].counter =  0 ;
                scorpionz[t].z_dep   =  12;
                board[x_x][x_y] = 12;
            }

            else if(board[x_x][x_y+1] == ' ' )
            {
                x_x = x_y + 1;
                scorpionz[t].x_coord = x_x;
                scorpionz[t].y_coord = x_y;
                scorpionz[t].counter =  0 ;
                scorpionz[t].z_dep   =  12;
                board[x_x][x_y] = 12;
            }

            else if(board[x_x-1][x_y] == ' ' )
            {
                x_x = x_x - 1;
                scorpionz[t].x_coord = x_x;
                scorpionz[t].y_coord = x_y;
                scorpionz[t].counter =  0 ;
                scorpionz[t].z_dep   =  12;
                board[x_x][x_y] = 12;
            }

            else if(board[x_x][x_y-1] == ' ' )
            {
                x_y = x_y - 1;
                scorpionz[t].x_coord = x_x;
                scorpionz[t].y_coord = x_y;
                scorpionz[t].counter =  0 ;
                scorpionz[t].z_dep   =  12;
                board[x_x][x_y] = 12;
            }
        }
    }

    bool check ( int new_index )
    {
        if ( scorpionz[new_index].x_coord != 0 && scorpionz[new_index].y_coord != 0 && scorpionz[new_index].z_dep == 12 )
            return true;

        else
            return false;
    }

    void displayArray()
    {
        for (int i=0; i<200; i++)
        {
            cout<< scorpionz[i].x_coord<<" "<< scorpionz[i].y_coord<<" "<< scorpionz[i].counter<<endl;
        }
    }

    int eat(int x_x, int x_y, int index2, int x_c)
    {
        if(board[x_x-1][x_y] == 30  && move(x_x, x_y, index2, x_c) == 1)
            return 11;
        if(board[x_x-1][x_y] == (char)250 && move(x_x, x_y, index2, x_c) == 1)
            return 12;
        if(board[x_x+1][x_y] == 30  && move(x_x, x_y, index2, x_c) == 2)
            return 21;
        if(board[x_x+1][x_y] == (char)250 && move(x_x, x_y, index2, x_c) == 2)
            return 22;
        if(board[x_x][x_y+1] == 30  && move(x_x, x_y, index2, x_c) == 3)
            return 31;
        if(board[x_x][x_y+1] == (char)250 && move(x_x, x_y, index2, x_c) == 3)
            return 32;
        if(board[x_x][x_y-1] == 30  && move(x_x, x_y, index2, x_c) == 4)
            return 41;
        if(board[x_x][x_y-1] == (char)250 && move(x_x, x_y, index2, x_c) == 4)
            return 42;

        return 0;
    }

};



class Snake
{
 private:
    int  s_x;
    int  s_y;
    char s_z;
    int  s_c;
    int count2;
    int flag2;

 public:
    objects snakez [200];
    Snake()
    {
        count2 = 0;
        flag2  = 0;
        for (int i=0; i<200; i++)
        {
            snakez[i].x_coord =  0 ;
            snakez[i].y_coord =  0 ;
            snakez[i].z_dep   = ' ';
            snakez[i].counter =  0 ;
        }
    }

    int getSX(int index1)
    {
        return snakez[index1].x_coord;
    }

    int getSY(int index1)
    {
        return snakez[index1].y_coord;
    }

    int getSC(int index1)
    {
        return snakez[index1].counter;
    }

    void setArray (int l, int m, char n, int index1, int cntr)
    {
        snakez[index1].x_coord =  l  ;
        snakez[index1].y_coord =  m  ;
        snakez[index1].z_dep   =  n  ;
        snakez[index1].counter = cntr;
    }

    void move (int s_x, int s_y, int index2, int s_c)
    {
        int g = 1;
        int h = 1;
        g = getch();
        h = getch();

        s_x = snakez[index2].x_coord;
        s_y = snakez[index2].y_coord;
        s_z = snakez[index2].z_dep  ;
        s_c = snakez[index2].counter;

        if( h == 27 )
        {
            system ("CLS");
            cout<<endl<<endl<<"\n"<<"\n"<<"\n";
            cout<< "                           Thank You For Playing!"<<endl<<endl<<endl<<endl;
            cout<<endl<<endl<<endl<<endl<<endl<<endl;
            exit(1);
        }

        if( h == 72 )
        {
            if(s_x > 1)
            {
                moveUp(s_x, s_y, index2, s_c);
                flag2 = 1;
                count2++;
            }
        }

        if( h == 80 )
        {
            if(s_x < 18)
            {
                moveDown(s_x, s_y, index2, s_c);
                flag2 = 2;
                count2++;
            }
        }
        if( h == 77)
        {
            if(s_y < 18)
            {
                moveRight(s_x, s_y, index2, s_c);
                flag2 = 3;
                count2++;
            }
        }
        if( h == 75 )
        {
            if(s_y > 1)
            {
                moveLeft(s_x, s_y, index2, s_c);
                flag2 = 4;
                count2++;
            }

        }
    }

    void moveUp( int s_x, int s_y, int index2, int s_c)
    {
        if(board[s_x-1][s_y] != 12 && board[s_x-1][s_y] != 23)
        {
            board[s_x][s_y] = ' ';
            s_c = s_c + 1;
            setArray ((s_x-1), s_y, 23, index2, s_c);
            board[s_x-1][s_y] = 23;
            s_x = s_x - 1;
            //delete Bug or Ant object in array
        }
        else
        {
            s_c = s_c + 1;
            setArray (s_x, (s_y), 23, index2, s_c);
            board[s_x][s_y] = 23;
        }
    }

    void moveDown( int s_x, int s_y, int index2, int s_c)
    {
        if(board[s_x+1][s_y] != 23 && board[s_x+1][s_y] != 12)
        {
            board[s_x][s_y] = ' ';
            s_c = s_c + 1;
            setArray ((s_x+1), s_y, 23, index2, s_c);
            board[s_x+1][s_y] = 23;
            s_x = s_x + 1;
            //delete Bug or Ant object in array
        }
        else
        {
            s_c = s_c + 1;
            setArray (s_x, (s_y), 23, index2, s_c);
            board[s_x][s_y] = 23;
        }
    }

    void moveRight( int s_x, int s_y, int index2, int s_c)
    {
        if(board[s_x][s_y+1] != 23 && board[s_x][s_y+1] != 12)
        {
            board[s_x][s_y] = ' ';
            s_c = s_c + 1;
            setArray (s_x, (s_y+1), 23, index2, s_c);
            board[s_x][s_y+1] = 23;
            s_y = s_y + 1;
            //delete Bug or Ant object in array
        }
        else
        {
            s_c = s_c + 1;
            setArray (s_x, (s_y), 23, index2, s_c);
            board[s_x][s_y] = 23;
        }

    }

    void moveLeft( int s_x, int s_y, int index2, int s_c)
    {
        if(board[s_x][s_y-1] != 23 && board[s_x][s_y-1] != 12)
        {
            board[s_x][s_y] = ' ';
            s_c = s_c + 1;
            setArray (s_x, (s_y-1), 23, index2, s_c);
            board[s_x][s_y-1] = 23;
            s_y = s_y - 1;
            //delete Bug or Ant object in array
        }
        else
        {
            s_c = s_c + 1;
            setArray (s_x, (s_y), 23, index2, s_c);
            board[s_x][s_y] = 23;
        }
    }

    void die (int s_x, int s_y, int index1, int counter)
    {

        s_x     = snakez[index1].x_coord;
        s_y     = snakez[index1].y_coord;
        counter = snakez[index1].counter;

        if( snakez[index1].counter == 6 )
        {
            setArray ( 0 , 0 , ' ' , index1, 0);
            board[s_x][s_y] = ' ';
        }
    }


    void breed(int s_x, int s_y, int index1, int s_c)
    {
        if( snakez[index1].counter % 12 == 0 )
        {
            s_x = snakez[index1].x_coord;
            s_y = snakez[index1].y_coord;
            s_c = snakez[index1].counter;

            int t;

            for(int j=0; j<200; j++)
            {
                if(snakez[j].x_coord == 0)
                {
                    t = j;
                    break;
                }
            }
            if(board[s_x+1][s_y] == ' ' )
            {
                s_x = s_x + 1;
                snakez[t].x_coord = s_x;
                snakez[t].y_coord = s_y;
                snakez[t].counter =  0 ;
                snakez[t].z_dep   =  23;
                board[s_x][s_y] = 23;
            }

            else if(board[s_x][s_y+1] == ' ' )
            {
                s_x = s_y + 1;
                snakez[t].x_coord = s_x;
                snakez[t].y_coord = s_y;
                snakez[t].counter =  0 ;
                snakez[t].z_dep   =  23;
                board[s_x][s_y] = 23;
            }

            else if(board[s_x-1][s_y] == ' ' )
            {
                s_x = s_x - 1;
                snakez[t].x_coord = s_x;
                snakez[t].y_coord = s_y;
                snakez[t].counter =  0 ;
                snakez[t].z_dep   =  23;
                board[s_x][s_y] = 23;
            }

            else if(board[s_x][s_y-1] == ' ' )
            {
                s_y = s_y - 1;
                snakez[t].x_coord = s_x;
                snakez[t].y_coord = s_y;
                snakez[t].counter =  0 ;
                snakez[t].z_dep   =  23;
                board[s_x][s_y] = 23;
            }
        }
    }

    bool check ( int new_index )
    {
        if ( snakez[new_index].x_coord != 0 && snakez[new_index].y_coord != 0 && snakez[new_index].z_dep == 23 )
            return true;

        else
            return false;
    }

    void displayArray()
    {
        for (int i=0; i<200; i++)
        {
            cout<< snakez[i].x_coord<<" "<< snakez[i].y_coord<<" "<< snakez[i].counter<<endl;
        }
    }

};



class Ant
{
 private:
    int  a_x;
    int  a_y;
    char a_z;
    int  a_c;
    int count3;
    int flag3;

 public:
    objects antz [400];
    Ant()
    {
        count3 = 0;
        flag3  = 0;
        for (int i=0; i<200; i++)
        {
            antz[i].x_coord =  0 ;
            antz[i].y_coord =  0 ;
            antz[i].z_dep   = ' ';
            antz[i].counter =  0 ;
        }
    }

    int getAX1(int index1)
    {
        return antz[index1].x_coord;
    }

    int geti(int value1, int value2)
    {
        for(int i=0; i<400; i++)
        {
            if(antz[i].x_coord == value1 && antz[i].y_coord == value2)
                return i;
        }
        return 0;
    }

    int getAY1(int index1)
    {
        return antz[index1].y_coord;
    }

    int getAC(int index1)
    {
        return antz[index1].counter;
    }

    void setArray (int l, int m, char n, int index1, int cntr)
    {
        antz[index1].x_coord =  l  ;
        antz[index1].y_coord =  m  ;
        antz[index1].z_dep   =  n  ;
        antz[index1].counter = cntr;
    }

    void move (int a_x, int a_y, int index2, int a_c)
    {
        int h = rand() % 4;

        a_x = antz[index2].x_coord;
        a_y = antz[index2].y_coord;
        a_z = antz[index2].z_dep  ;
        a_c = antz[index2].counter;

        if( h == 0 )
        {
            if(a_x > 1)
            {
                moveUp(a_x, a_y, index2, a_c);
                flag3 = 1;
                count3++;
            }
        }

        if( h == 1 )
        {
            if(a_x < 18)
            {
                moveDown(a_x, a_y, index2, a_c);
                flag3 = 2;
                count3++;
            }
        }
        if( h == 2 )
        {
            if(a_y < 18)
            {
                moveRight(a_x, a_y, index2, a_c);
                flag3 = 3;
                count3++;
            }
        }
        if( h == 3 )
        {
            if(a_y > 1)
            {
                moveLeft(a_x, a_y, index2, a_c);
                flag3 = 4;
                count3++;
            }

        }
    }

    void moveUp( int a_x, int a_y, int index2, int a_c )
    {
        if(board[a_x-1][a_y] != 23 && board[a_x-1][a_y] != 30 && board[a_x-1][a_y] != 12 && board[a_x-1][a_y] != 29 && board[a_x-1][a_y] != (char)250)
        {
            board[a_x][a_y] = ' ';
            a_c = a_c + 1;
            setArray ((a_x-1), a_y, 30, index2, a_c);
            board[a_x-1][a_y] = 30;
            a_x = a_x - 1;
            //delete Bug or Ant object in array
        }
        else
        {
            a_c = a_c + 1;
            setArray (a_x, (a_y), 30, index2, a_c);
            board[a_x][a_y] = 30;
        }
    }

    void moveDown( int a_x, int a_y, int index2, int a_c )
    {
        if(board[a_x+1][a_y] != 23 && board[a_x+1][a_y] != 30 && board[a_x+1][a_y] != 12 && board[a_x+1][a_y] != 29 && board[a_x+1][a_y] != (char)250)
        {
            board[a_x][a_y] = ' ';
            a_c = a_c + 1;
            setArray ((a_x+1), a_y, 30, index2, a_c);
            board[a_x+1][a_y] = 30;
            a_x = a_x + 1;
            //delete Bug or Ant object in array
        }
        else
        {
            a_c = a_c + 1;
            setArray (a_x, (a_y), 30, index2, a_c);
            board[a_x][a_y] = 30;
        }
    }

    void moveRight( int a_x, int a_y, int index2, int a_c)
    {
        if(board[a_x][a_y+1] != 23 && board[a_x][a_y+1] != 30 && board[a_x][a_y+1] != 12 && board[a_x][a_y+1] != 29 && board[a_x][a_y+1] != (char)250)
        {
            board[a_x][a_y] = ' ';
            a_c = a_c + 1;
            setArray (a_x, (a_y+1), 30, index2, a_c);
            board[a_x][a_y+1] = 30;
            a_y = a_y + 1;
            //delete Bug or Ant object in array
        }
        else
        {
            a_c = a_c + 1;
            setArray (a_x, (a_y), 30, index2, a_c);
            board[a_x][a_y] = 30;
        }

    }

    void moveLeft( int a_x, int a_y, int index2, int a_c)
    {
        if(board[a_x][a_y-1] != 23 && board[a_x][a_y-1] != 30 && board[a_x][a_y-1] != 12 && board[a_x][a_y-1] != 29 && board[a_x][a_y-1] != (char)250)
        {
            board[a_x][a_y] = ' ';
            a_c = a_c + 1;
            setArray (a_x, (a_y-1), 30, index2, a_c);
            board[a_x][a_y-1] = 30;
            a_y = a_y - 1;
            //delete Bug or Ant object in array
        }
        else
        {
            a_c = a_c + 1;
            setArray (a_x, (a_y), 30, index2, a_c);
            board[a_x][a_y] = 30;
        }
    }

    void die (int a_x, int a_y, int index1, int counter)
    {

        a_x     = antz[index1].x_coord;
        a_y     = antz[index1].y_coord;
        counter = antz[index1].counter;

        if( antz[index1].counter == 12 )
        {
            setArray ( 0 , 0 , ' ' , index1, 0);
            board[a_x][a_y] = ' ';
        }
    }


    void breed(int a_x, int a_y, int index1, int a_c)
    {
        if( antz[index1].counter % 12 == 0 )
        {
            a_x = antz[index1].x_coord;
            a_y = antz[index1].y_coord;
            a_c = antz[index1].counter;

            int t;

            for(int j=0; j<200; j++)
            {
                if(antz[j].x_coord == 0)
                {
                    t = j;
                    break;
                }
            }
            if(board[a_x+1][a_y] == ' ' )
            {
                a_x = a_x + 1;
                antz[t].x_coord = a_x;
                antz[t].y_coord = a_y;
                antz[t].counter =  0 ;
                antz[t].z_dep   =  30;
                board[a_x][a_y] = 30;
            }

            else if(board[a_x][a_y+1] == ' ' )
            {
                a_x = a_y + 1;
                antz[t].x_coord = a_x;
                antz[t].y_coord = a_y;
                antz[t].counter =  0 ;
                antz[t].z_dep   =  30;
                board[a_x][a_y] =  30;
            }

            else if(board[a_x-1][a_y] == ' ' )
            {
                a_x = a_x - 1;
                antz[t].x_coord = a_x;
                antz[t].y_coord = a_y;
                antz[t].counter =  0 ;
                antz[t].z_dep   =  30;
                board[a_x][a_y]   =  30;
            }

            else if(board[a_x][a_y-1] == ' ' )
            {
                a_y = a_y - 1;
                antz[t].x_coord = a_x;
                antz[t].y_coord = a_y;
                antz[t].counter =  0 ;
                antz[t].z_dep   =  30;
                board[a_x][a_y] =  30;
            }
        }
    }

    bool check ( int new_index )
    {
        if ( antz[new_index].x_coord != 0 && antz[new_index].y_coord != 0 && antz[new_index].z_dep == 30 )
            return true;

        else
            return false;
    }

    void displayArray()
    {
        for (int i=0; i<200; i++)
        {
            cout<< antz[i].x_coord<<" "<< antz[i].y_coord<<" "<< antz[i].counter<<endl;
        }
    }

};


class Bug
{
 private:
    int  b_x;
    int  b_y;
    char b_z;
    int  b_c;
    int count4;
    int flag4;

 public:
    objects bugz [400];
    Bug()
    {
        count4 = 0;
        flag4  = 0;
        for (int i=0; i<200; i++)
        {
            bugz[i].x_coord =  0 ;
            bugz[i].y_coord =  0 ;
            bugz[i].z_dep   = ' ';
            bugz[i].counter =  0 ;
        }
    }

    int getBX1(int index1)
    {
        return bugz[index1].x_coord;
    }

    int getBX2(int value1, int value2)
    {
        for(int i=0; i<400; i++)
        {
            if(bugz[i].x_coord == value1 && bugz[i].y_coord == value2)
                return i;
        }
    }

    int getBY1(int index1)
    {
        return bugz[index1].y_coord;
    }

    int getBC(int index1)
    {
        return bugz[index1].counter;
    }

    void setArray (int l, int m, char n, int index1, int cntr)
    {
        bugz[index1].x_coord =  l  ;
        bugz[index1].y_coord =  m  ;
        bugz[index1].z_dep   =  n  ;
        bugz[index1].counter = cntr;
    }

    void move (int a_x, int a_y, int index2, int a_c)
    {
        int h = rand() % 4;

        b_x = bugz[index2].x_coord;
        b_y = bugz[index2].y_coord;
        b_z = bugz[index2].z_dep  ;
        b_c = bugz[index2].counter;

        if( h == 0 )
        {
            if(b_x > 1)
            {
                moveUp(b_x, b_y, index2, b_c);
                flag4 = 1;
                count4++;
            }
        }

        if( h == 1 )
        {
            if(b_x < 18)
            {
                moveDown(b_x, b_y, index2, b_c);
                flag4 = 2;
                count4++;
            }
        }
        if( h == 2 )
        {
            if(b_y < 18)
            {
                moveRight(b_x, b_y, index2, b_c);
                flag4 = 3;
                count4++;
            }
        }
        if( h == 3 )
        {
            if(b_y > 1)
            {
                moveLeft(b_x, b_y, index2, b_c);
                flag4 = 4;
                count4++;
            }

        }
    }

    void moveUp( int b_x, int b_y, int index2, int b_c )
    {
        if(board[b_x-1][b_y] != 23 && board[b_x-1][b_y] != 30 && board[b_x-1][b_y] != 12 && board[b_x-1][b_y] != 29 && board[b_x-1][b_y] != (char)250)
        {
            board[b_x][b_y] = ' ';
            b_c = b_c + 1;
            setArray ((b_x-1), b_y, 250, index2, b_c);
            board[b_x-1][b_y] = 250;
            b_x = b_x - 1;
            //delete Bug or Ant object in array
        }
        else
        {
            b_c = b_c + 1;
            setArray (b_x, (b_y), 250, index2, b_c);
            board[b_x][b_y] = 250;
        }
    }

    void moveDown( int b_x, int b_y, int index2, int b_c )
    {
        if(board[b_x+1][b_y] != 23 && board[b_x+1][b_y] != 30 && board[b_x+1][b_y] != 12 && board[b_x+1][b_y] != 29 && board[b_x+1][b_y] != (char)250)
        {
            board[b_x][b_y] = ' ';
            b_c = b_c + 1;
            setArray ((b_x+1), b_y, 250, index2, b_c);
            board[b_x+1][b_y] = 250;
            b_x = b_x + 1;
            //delete Bug or Ant object in array
        }
        else
        {
            b_c = b_c + 1;
            setArray (b_x, (b_y), 250, index2, b_c);
            board[b_x][b_y] = 250;
        }
    }

    void moveRight( int b_x, int b_y, int index2, int b_c)
    {
        if(board[b_x][b_y+1] != 23 && board[b_x][b_y+1] != 30 && board[b_x][b_y+1] != 12 && board[b_x][b_y+1] != 29 && board[b_x][b_y+1] != (char)250)
        {
            board[b_x][b_y] = ' ';
            b_c = b_c + 1;
            setArray (b_x, (b_y+1), 250, index2, b_c);
            board[b_x][b_y+1] = 250;
            b_y = b_y + 1;
            //delete Bug or Ant object in array
        }
        else
        {
            b_c = b_c + 1;
            setArray (b_x, (b_y), 250, index2, b_c);
            board[b_x][b_y] = 250;
        }

    }

    void moveLeft( int b_x, int b_y, int index2, int b_c)
    {
        if(board[b_x][b_y-1] != 23 && board[b_x][b_y-1] != 30 && board[b_x][b_y-1] != 12 && board[b_x][b_y-1] != 29 && board[b_x][b_y-1] != (char)250)
        {
            board[b_x][b_y] = ' ';
            b_c = b_c + 1;
            setArray (b_x, (b_y-1), 250, index2, b_c);
            board[b_x][b_y-1] = 250;
            b_y = b_y - 1;
            //delete Bug or Ant object in array
        }
        else
        {
            b_c = b_c + 1;
            setArray (b_x, (b_y), 250, index2, b_c);
            board[b_x][b_y] = 250;
        }
    }

    void die (int b_x, int b_y, int index1, int counter)
    {

        b_x     = bugz[index1].x_coord;
        b_y     = bugz[index1].y_coord;
        counter = bugz[index1].counter;

        if( bugz[index1].counter == 12 )
        {
            setArray ( 0 , 0 , ' ' , index1, 0);
            board[b_x][b_y] = ' ';
        }
    }


    void breed(int b_x, int b_y, int index1, int b_c)
    {
        if( bugz[index1].counter % 12 == 0 )
        {
            b_x = bugz[index1].x_coord;
            b_y = bugz[index1].y_coord;
            b_c = bugz[index1].counter;

            int t;

            for(int j=0; j<200; j++)
            {
                if(bugz[j].x_coord == 0)
                {
                    t = j;
                    break;
                }
            }
            if(board[b_x+1][b_y] == ' ' )
            {
                b_x = b_x + 1;
                bugz[t].x_coord = b_x;
                bugz[t].y_coord = b_y;
                bugz[t].counter =  0 ;
                bugz[t].z_dep   = 250;
                board[b_x][b_y] = 250;
            }

            else if(board[b_x][b_y+1] == ' ' )
            {
                b_x = b_y + 1;
                bugz[t].x_coord = b_x;
                bugz[t].y_coord = b_y;
                bugz[t].counter =  0 ;
                bugz[t].z_dep   = 250;
                board[b_x][b_y] = 250;
            }

            else if(board[b_x-1][b_y] == ' ' )
            {
                b_x = b_x - 1;
                bugz[t].x_coord = b_x;
                bugz[t].y_coord = b_y;
                bugz[t].counter =  0 ;
                bugz[t].z_dep   = 250;
                board[b_x][b_y] = 250;
            }

            else if(board[b_x][b_y-1] == ' ' )
            {
                b_y = b_y - 1;
                bugz[t].x_coord = b_x;
                bugz[t].y_coord = b_y;
                bugz[t].counter =  0 ;
                bugz[t].z_dep   = 250;
                board[b_x][b_y] = 250;
            }
        }
    }

    bool check ( int new_index )
    {
        if ( bugz[new_index].x_coord != 0 && bugz[new_index].y_coord != 0 && bugz[new_index].z_dep == (char)250 )
            return true;

        else
            return false;
    }

};


class Worm
{
 private:
    int  w_x;
    int  w_y;
    char w_z;
    int  w_c;
    int count5;
    int flag5;

 public:
    objects wormz [400];
    Worm()
    {
        count5 = 0;
        flag5  = 0;
        for (int i=0; i<200; i++)
        {
            wormz[i].x_coord =  0 ;
            wormz[i].y_coord =  0 ;
            wormz[i].z_dep   = ' ';
            wormz[i].counter =  0 ;
        }
    }

    int getWX1(int index1)
    {
        return wormz[index1].x_coord;
    }

    int geti(int value1, int value2)
    {
        for(int i=0; i<400; i++)
        {
            if(wormz[i].x_coord == value1 && wormz[i].y_coord == value2)
                return i;
        }
        return 0;
    }

    int getWY1(int index1)
    {
        return wormz[index1].y_coord;
    }

    int getWC(int index1)
    {
        return wormz[index1].counter;
    }

    void setArray (int l, int m, char n, int index1, int cntr)
    {
        wormz[index1].x_coord =  l  ;
        wormz[index1].y_coord =  m  ;
        wormz[index1].z_dep   =  n  ;
        wormz[index1].counter = cntr;
    }

    void move (int w_x, int w_y, int index2, int w_c)
    {
        int h = rand() % 4;

        w_x = wormz[index2].x_coord;
        w_y = wormz[index2].y_coord;
        w_z = wormz[index2].z_dep  ;
        w_c = wormz[index2].counter;

        if( h == 0 )
        {
            if(w_x > 1)
            {
                moveUp(w_x, w_y, index2, w_c);
                flag5 = 1;
                count5++;
            }
        }

        if( h == 1 )
        {
            if(w_x < 18)
            {
                moveDown(w_x, w_y, index2, w_c);
                flag5 = 2;
                count5++;
            }
        }
        if( h == 2 )
        {
            if(w_y < 18)
            {
                moveRight(w_x, w_y, index2, w_c);
                flag5 = 3;
                count5++;
            }
        }
        if( h == 3 )
        {
            if(w_y > 1)
            {
                moveLeft(w_x, w_y, index2, w_c);
                flag5 = 4;
                count5++;
            }

        }
    }

    void moveUp( int w_x, int w_y, int index2, int w_c )
    {
        if(board[w_x-1][w_y] != 23 && board[w_x-1][w_y] != 30 && board[w_x-1][w_y] != 12 && board[w_x-1][w_y] != 29 && board[w_x-1][w_y] != (char)250)
        {
            board[w_x][w_y] = ' ';
            w_c = w_c + 1;
            setArray ((w_x-1), w_y, 29, index2, w_c);
            board[w_x-1][w_y] = 29;
            w_x = w_x - 1;
            //delete Bug or Ant object in array
        }
        else
        {
            w_c = w_c + 1;
            setArray (w_x, (w_y), 29, index2, w_c);
            board[w_x][w_y] = 29;
        }
    }

    void moveDown( int w_x, int w_y, int index2, int w_c )
    {
        if(board[w_x+1][w_y] != 23 && board[w_x+1][w_y] != 30 && board[w_x+1][w_y] != 12 && board[w_x+1][w_y] != 29 && board[w_x+1][w_y] != (char)250)
        {
            board[w_x][w_y] = ' ';
            w_c = w_c + 1;
            setArray ((w_x+1), w_y, 29, index2, w_c);
            board[w_x+1][w_y] = 29;
            w_x = w_x + 1;
            //delete Bug or Ant object in array
        }
        else
        {
            w_c = w_c + 1;
            setArray (w_x, (w_y), 29, index2, w_c);
            board[w_x][w_y] = 29;
        }
    }

    void moveRight( int w_x, int w_y, int index2, int w_c)
    {
        if(board[w_x][w_y+1] != 23 && board[w_x][w_y+1] != 30 && board[w_x][w_y+1] != 12 && board[w_x][w_y+1] != 29 && board[w_x][w_y+1] != (char)250)
        {
            board[w_x][w_y] = ' ';
            w_c = w_c + 1;
            setArray (w_x, (w_y+1), 29, index2, w_c);
            board[w_x][w_y+1] = 29;
            w_y = w_y + 1;
            //delete Bug or Ant object in array
        }
        else
        {
            w_c = w_c + 1;
            setArray (w_x, (w_y), 29, index2, w_c);
            board[w_x][w_y] = 29;
        }

    }

    void moveLeft( int w_x, int w_y, int index2, int w_c)
    {
        if(board[w_x][w_y-1] != 23 && board[w_x][w_y-1] != 30 && board[w_x][w_y-1] != 12 && board[w_x][w_y-1] != 29 && board[w_x][w_y-1] != (char)250)
        {
            board[w_x][w_y] = ' ';
            w_c = w_c + 1;
            setArray (w_x, (w_y-1), 29, index2, w_c);
            board[w_x][w_y-1] = 29;
            w_y = w_y - 1;
            //delete Bug or Ant object in array
        }
        else
        {
            w_c = w_c + 1;
            setArray (w_x, (w_y), 29, index2, w_c);
            board[w_x][w_y] = 29;
        }
    }

    void die (int w_x, int w_y, int index1, int counter)
    {

        w_x     = wormz[index1].x_coord;
        w_y     = wormz[index1].y_coord;
        counter = wormz[index1].counter;

        if( wormz[index1].counter == 12 )
        {
            setArray ( 0 , 0 , ' ' , index1, 0);
            board[w_x][w_y] = ' ';
        }
    }


    void breed(int w_x, int w_y, int index1, int w_c)
    {
        if( wormz[index1].counter % 12 == 0 )
        {
            w_x = wormz[index1].x_coord;
            w_y = wormz[index1].y_coord;
            w_c = wormz[index1].counter;

            int t;

            for(int j=0; j<200; j++)
            {
                if(wormz[j].x_coord == 0)
                {
                    t = j;
                    break;
                }
            }
            if(board[w_x+1][w_y] == ' ' )
            {
                w_x = w_x + 1;
                wormz[t].x_coord = w_x;
                wormz[t].y_coord = w_y;
                wormz[t].counter =  0 ;
                wormz[t].z_dep   =  29;
                board[w_x][w_y]  =  29;
            }

            else if(board[w_x][w_y+1] == ' ' )
            {
                w_x = w_y + 1;
                wormz[t].x_coord = w_x;
                wormz[t].y_coord = w_y;
                wormz[t].counter =  0 ;
                wormz[t].z_dep   =  29;
                board[w_x][w_y]  =  29;
            }

            else if(board[w_x-1][w_y] == ' ' )
            {
                w_x = w_x - 1;
                wormz[t].x_coord = w_x;
                wormz[t].y_coord = w_y;
                wormz[t].counter =  0 ;
                wormz[t].z_dep   =  29;
                board[w_x][w_y]  =  29;
            }

            else if(board[w_x][w_y-1] == ' ' )
            {
                w_y = w_y - 1;
                wormz[t].x_coord = w_x;
                wormz[t].y_coord = w_y;
                wormz[t].counter =  0 ;
                wormz[t].z_dep   =  29;
                board[w_x][w_y]  =  29;
            }
        }
    }

    bool check ( int new_index )
    {
        if ( wormz[new_index].x_coord != 0 && wormz[new_index].y_coord != 0 && wormz[new_index].z_dep == 29 )
            return true;

        else
            return false;
    }

    void displayArray()
    {
        for (int i=0; i<200; i++)
        {
            cout<< wormz[i].x_coord<<" "<< wormz[i].y_coord<<" "<< wormz[i].counter<<endl;
        }
    }

};



int main()
{
    int new_index1  = 0;
    int new_index2  = 0;
    int new_index3  = 0;
    int new_index4  = 0;
    int new_index5  = 0;
    int new_index6  = 0;
    int new_index7  = 0;
    int new_index8  = 0;
    int moveCounter = 0;
    int flag1       = 0;
    int flag2       = 0;

    setBoard();

    Scorpion sco;

    Snake    sna;

    Ant      ant;

    Bug      bug;

    Worm    worm;

    sco.setArray(10, 10, 12, 0, 0);
    sna.setArray(4 , 4 , 23, 0, 0);
    for(int y=0; y<12; y++)
    {
        int r = rand() % 18 + 1;
        int s = rand() % 18 + 1;
        ant.setArray(r , s , 30, y , 0);
        board[r][s] = 30;
    }

    for(int y=0; y<12; y++)
    {
        int r = rand() % 18 + 1;
        int s = rand() % 18 + 1;
        bug.setArray(r , s , (char)250, y , 0);
        board[r][s] = 250;
    }

    for(int y=0; y<12; y++)
    {
        int r = rand() % 18 + 1;
        int s = rand() % 18 + 1;
        worm.setArray(r , s , 29, y , 0);
        board[r][s] = 29;
    }

    cout<<endl<<endl<<endl<<endl<<endl<<"                         Welcome to Predators VS. Preys 1.0"<<endl;
    cout<<endl<<"                         Press any Enter to Continue..."<<endl<<endl<<endl<<endl<<endl;
    int t;
    t = getch();

    system("CLS");

    cout<<endl<<endl<<endl;
    cout<<"      "<<(char) 12<<"  :  is the Scorpion."<<endl<<endl;
    cout<<"      "<<(char) 23<<"  :  is the Snake."   <<endl<<endl;
    cout<<"      "<<(char) 30<<"  :  is the Ant."     <<endl<<endl;
    cout<<"      "<<(char) 250<<"  :  is the Bug."    <<endl<<endl;
    cout<<"      "<<(char) 29<<"  :  is the Worm."    <<endl<<endl;

    cout<<endl<<endl<<endl<<"                         Press any Enter when you're ready to START..."<<endl<<endl<<endl<<endl<<endl;

    t = getch();

    system("CLS");

    board[10][10] = 12;
    board[ 4][ 4] = 23;
    displayBoard();

    cout<<endl<<"Number of Moves: "<<moveCounter<<endl;

    while (1)
    {
        flag1 = 0;
        flag2 = 0;
        new_index1 = 0;
        new_index2 = 0;
        new_index3 = 0;
        new_index4 = 0;
        new_index5 = 0;
        new_index6 = 0;
        new_index7 = 0;
        new_index8 = 0;
        while(1)
        {

            //cout<<"new_index1: "<<new_index1<<endl;
            if(sco.check(new_index1) == true)
            {
                //sco.displayArray();
                sco.move(sco.getXX(new_index1), sco.getXY(new_index1), new_index1, sco.getXC(new_index1));
                if(sco.eat(sco.getXX(new_index1), sco.getXY(new_index1), new_index1, sco.getXC(new_index1)) == 11)
                    ant.setArray(0, 0, ' ', ant.geti( sco.getXX(new_index1) , sco.getXY(new_index1) ), 0);
                if(sco.eat(sco.getXX(new_index1), sco.getXY(new_index1), new_index1, sco.getXC(new_index1)) == 12)
                    bug.setArray(0, 0, ' ', ant.geti( sco.getXX(new_index1) , sco.getXY(new_index1) ), 0);
                if(sco.eat(sco.getXX(new_index1), sco.getXY(new_index1), new_index1, sco.getXC(new_index1)) == 21)
                    ant.setArray(0, 0, ' ', ant.geti( sco.getXX(new_index1) , sco.getXY(new_index1) ), 0);
                if(sco.eat(sco.getXX(new_index1), sco.getXY(new_index1), new_index1, sco.getXC(new_index1)) == 22)
                    bug.setArray(0, 0, ' ', ant.geti( sco.getXX(new_index1) , sco.getXY(new_index1) ), 0);
                if(sco.eat(sco.getXX(new_index1), sco.getXY(new_index1), new_index1, sco.getXC(new_index1)) == 31)
                    ant.setArray(0, 0, ' ', ant.geti( sco.getXX(new_index1) , sco.getXY(new_index1) ), 0);
                if(sco.eat(sco.getXX(new_index1), sco.getXY(new_index1), new_index1, sco.getXC(new_index1)) == 32)
                    bug.setArray(0, 0, ' ', ant.geti( sco.getXX(new_index1) , sco.getXY(new_index1) ), 0);
                if(sco.eat(sco.getXX(new_index1), sco.getXY(new_index1), new_index1, sco.getXC(new_index1)) == 41)
                    ant.setArray(0, 0, ' ', ant.geti( sco.getXX(new_index1) , sco.getXY(new_index1) ), 0);
                if(sco.eat(sco.getXX(new_index1), sco.getXY(new_index1), new_index1, sco.getXC(new_index1)) == 42)
                    bug.setArray(0, 0, ' ', ant.geti( sco.getXX(new_index1) , sco.getXY(new_index1) ), 0);

                system("CLS");
                sco.die(sco.getXX(new_index1), sco.getXY(new_index1), new_index1, sco.getXC(new_index1));
                sco.breed(sco.getXX(new_index1), sco.getXY(new_index1), new_index1, moveCounter);
                displayBoard();
                flag1 = 1;
                new_index1 = new_index1 + 1;
                moveCounter++;
            } else {
                break;
            }
        }
        /*if(flag1 == 1)
        {
            //cout<<"index1 before: " <<new_index1<<endl;
            new_index1 = new_index1 + 1;
            cout<<"index1  after: "<<new_index1<<endl;
        } else {
            cout << "reset" <<endl;
            new_index1 = 0;
        }
        if(new_index1 = 200)
        {
            cout << new_index1 << endl;
            new_index1 = 0;
        }*/
        //sco.displayArray();

        if(flag1 == 1)
        {
            while(1)
            {
                //cout<<"new_index3: "<<new_index3<<endl;
                if(ant.check(new_index2) == true)
                {
                    ant.move(ant.getAX1(new_index2), ant.getAY1(new_index2), new_index2, ant.getAC(new_index2));
                    system("CLS");
                    //ant.die(ant.getAX1(new_index2), ant.getAY1(new_index2), new_index2, ant.getAC(new_index2));
                    ant.breed(ant.getAX1(new_index2), ant.getAY1(new_index2), new_index2, moveCounter);
                    displayBoard();
                    new_index2 = new_index2 + 1;
                }else if(new_index2 == 400){
                    break;
                }else {
                    new_index2 = new_index2 + 1;
                }
                //new_index3 = new_index3 + 1;
                //cout<<"index1 el gdeed: "<<new_index1<<endl;

                /*if(flag1 == 0)
                {
                    //cout<<"index2 before: " <<new_index2<<endl;
                    new_index3 = new_index3 + 1;
                    //cout<<"index2  after: "<<new_index2<<endl;
                }
                if(new_index3 = 200)
                {
                    new_index3 = 0;
                }*/
            }

            while(1)
            {
                if(bug.check(new_index3) == true)
                {
                    bug.move(bug.getBX1(new_index3), bug.getBY1(new_index3), new_index3, bug.getBC(new_index3));
                    system("CLS");
                    //bug.die(bug.getBX1(new_index3), bug.getBY1(new_index3), new_index3, bug.getBC(new_index3));
                    bug.breed(bug.getBX1(new_index3), bug.getBY1(new_index3), new_index3, moveCounter);
                    displayBoard();
                    flag1 = 1;
                    new_index3 = new_index3 + 1;
                }else if(new_index3 == 400){
                    break;
                }else {
                    new_index3 = new_index3 + 1;
                }
                //new_index3 = new_index3 + 1;
                //cout<<"index1 el gdeed: "<<new_index1<<endl;

                /*if(flag1 == 0)
                {
                    //cout<<"index2 before: " <<new_index2<<endl;
                    new_index3 = new_index3 + 1;
                    //cout<<"index2  after: "<<new_index2<<endl;
                }
                if(new_index3 = 200)
                {
                    new_index3 = 0;
                }*/
            }

            while(1)
            {
                if(worm.check(new_index4) == true)
                {
                    worm.move(worm.getWX1(new_index4), worm.getWY1(new_index4), new_index4, worm.getWC(new_index4));
                    system("CLS");
                    //worm.die(worm.getWX1(new_index4), worm.getWY1(new_index4), new_index4, worm.getWC(new_index4));
                    worm.breed(worm.getWX1(new_index4), worm.getWY1(new_index4), new_index4, moveCounter);
                    displayBoard();
                    flag1 = 1;
                    //break;
                    new_index4 = new_index4 + 1;
                }else if(new_index4 == 400){
                    break;
                }else {
                    new_index4 = new_index4 + 1;
                }
            }

            cout<<endl<<"Number of Moves: "<<moveCounter<<endl;
        }

        while(1)
        {
            if(sna.check(new_index5) == true)
            {
                sna.move(sna.getSX(new_index5), sna.getSY(new_index5), new_index5, sna.getSC(new_index5));
                system("CLS");
                //sna.die(sna.getSX(new_index5), sna.getSY(new_index5), new_index5, sna.getSC(new_index5));
                sna.breed(sna.getSX(new_index5), sna.getSY(new_index5), new_index5, sna.getSC(new_index5));
                displayBoard();
                //cout<<"x: "<<sna.getSX(new_index2)<<"  "<<"  y: "<<sna.getSY(new_index2)<<"   z: "<<new_index2<<"   c: "<<sna.getSC(new_index2)<<endl;
                flag2 = 1;
                //break;
                new_index5 = new_index5 + 1;
                moveCounter++;
            }else {
                break;
            }
        }
        /*if(flag1 == 0)
        {
            //cout<<"index2 before: " <<new_index2<<endl;
            new_index2 = new_index2 + 1;
            //cout<<"index2  after: "<<new_index2<<endl;
        }
        if(new_index2 = 200)
        {
            new_index2 = 0;
        }*/
        //sna.displayArray();

        if(flag2 == 1)
        {
            while(1)
            {
                //cout<<"new_index3: "<<new_index3<<endl;
                if(ant.check(new_index6) == true)
                {
                    ant.move(ant.getAX1(new_index6), ant.getAY1(new_index6), new_index6, ant.getAC(new_index6));
                    system("CLS");
                    //ant.die(ant.getAX1(new_index6), ant.getAY1(new_index6), new_index6, sco.getAC(new_index6));
                    ant.breed(ant.getAX1(new_index6), ant.getAY1(new_index6), new_index6, moveCounter);
                    displayBoard();
                    //cout<<"x: "<<sco.getXX(new_index1)<<"  "<<"  y: "<<sco.getXY(new_index1)<<"   z: "<<new_index1<<"   c: "<<sco.getXC(new_index1)<<endl;
                    flag1 = 1;
                    //break;
                    new_index6 = new_index6 + 1;
                    break;
                }else if(new_index6 == 400){
                    new_index6 = 0;
                }else {
                    new_index6 = new_index6 + 1;
                }
            }
                //new_index3 = new_index3 + 1;
                //cout<<"index1 el gdeed: "<<new_index1<<endl;

                /*if(flag1 == 0)
                {
                    //cout<<"index2 before: " <<new_index2<<endl;
                    new_index3 = new_index3 + 1;
                    //cout<<"index2  after: "<<new_index2<<endl;
                }
                if(new_index3 = 200)
                {
                    new_index3 = 0;
                }
                moveCounter++;*/

            while(1)
            {
                //cout<<"new_index3: "<<new_index3<<endl;
                if(bug.check(new_index7) == true)
                {
                    bug.move(bug.getBX1(new_index7), bug.getBY1(new_index7), new_index7, bug.getBC(new_index7));
                    system("CLS");
                    //bug.die(bug.getBX1(new_index7), bug.getBY1(new_index7), new_index7, bug.getBC(new_index7));
                    bug.breed(bug.getBX1(new_index7), bug.getBY1(new_index7), new_index7, moveCounter);
                    displayBoard();
                    //cout<<"x: "<<sco.getXX(new_index1)<<"  "<<"  y: "<<sco.getXY(new_index1)<<"   z: "<<new_index1<<"   c: "<<sco.getXC(new_index1)<<endl;
                    flag1 = 1;
                    //break;
                    new_index7 = new_index7 + 1;
                }else if(new_index7 == 400){
                    break;
                }else {
                    new_index7 = new_index7 + 1;
                }
                //new_index3 = new_index3 + 1;
                //cout<<"index1 el gdeed: "<<new_index1<<endl;

                /*if(flag1 == 0)
                {
                    //cout<<"index2 before: " <<new_index2<<endl;
                    new_index3 = new_index3 + 1;
                    //cout<<"index2  after: "<<new_index2<<endl;
                }
                if(new_index3 = 200)
                {
                    new_index3 = 0;
                }*/
            }


            while(1)
            {
                //cout<<"new_index3: "<<new_index3<<endl;
                if(worm.check(new_index8) == true)
                {
                    worm.move(worm.getWX1(new_index8), worm.getWY1(new_index8), new_index8, worm.getWC(new_index8));
                    system("CLS");
                    //worm.die(worm.getWX1(new_index8), worm.getWY1(new_index8), new_index8, worm.getWC(new_index8));
                    worm.breed(worm.getWX1(new_index8), worm.getWY1(new_index8), new_index8, moveCounter);
                    displayBoard();
                    flag1 = 1;
                    //break;
                    new_index8 = new_index8 + 1;
                }else if(new_index8 == 400){
                    break;
                }else {
                    new_index8 = new_index8 + 1;
                }
            }

            cout<<endl<<"Number of Moves: "<<moveCounter<<endl;
        }
    }

    return 0;
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.