1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
class Piece
{
private:
int x, y, color;
public:
Piece()
{
x = -1;
y = -1;
color = 2;
}
void setcolor(int c)
{
color = c;
}
void setposition(int x_pos, int y_pos, int c)
{
x = x_pos;
y = y_pos;
color = c;
}
void set(int x_pos, int y_pos)
{
x = x_pos;
y = y_pos;
}
int getc()
{
return color;
}
int getx()
{
return x;
}
int gety()
{
return y;
}
void display();
};
class Board
{
private:
Piece list[64], newlist[64];// you see how made an array of the pieces
int x1, y1, h, loc, col;
int status, redpiece, greenpiece, winner;
int stat(int h);
int inRange(int x, int y);
int pieceAtLoc(int x, int y);
int validPlacement(int x, int y, int loc, int col);
void flip(int x, int y, int loc);
void display();
void move();
public:
Board();
void execute();
};
| |