Initial commit

This commit is contained in:
2014-09-30 17:09:22 +03:00
commit 1d8061ef10
18 changed files with 1345 additions and 0 deletions

71
piece.h Normal file
View File

@@ -0,0 +1,71 @@
#ifndef PIECE_H
#define PIECE_H
enum team {
WHITE,
BLACK
};
enum rank {
KING = 1,
QUEEN,
KNIGHT,
BISHOP,
ROOK,
PAWN
};
enum status {
MENU,
MOVING,
CASTLING,
INCORRECT_INPUT,
MOVE_IMPOSSIBLE,
MOVE_SUCCESSFUL,
MOVE_PAWN_IMPOSSIBLE,
MOVE_PAWN_PROMOTION,
MOVE_PATH_PROBLEM,
MOVE_NO_CHANGE,
MOVE_OK,
MOVE_PAWN_PROMOTED,
MOVE_WRONG_TURN,
KING_MOVING,
CASTLING_LEFT,
CASTLING_RIGHT,
CASTLING_FORBIDDEN_LEFT,
CASTLING_FORBIDDEN_RIGHT,
CASTLING_UNDER_CHECK,
CASTLING_PATH_PROBLEM,
CHECK_PREVENT,
CHECK_WARNING,
CHECKMATE
};
class piece {
protected:
int x, y;
int rank;
int team;
public:
virtual ~piece() {}
virtual void move(int, int) = 0;
inline int rank_is()
{
return rank;
}
inline int team_is()
{
return team;
}
inline void get_coords(int &x, int &y)
{
x = this->x;
y = this->y;
}
};
#endif // PIECE_H