Initial commit
This commit is contained in:
71
piece.h
Normal file
71
piece.h
Normal 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
|
||||
Reference in New Issue
Block a user