chessCAMO
chess.h
Go to the documentation of this file.
1 
50 #ifndef CHESS_H // header guard to prevent multiple includes of the classes (results in compilation error)
51 #define CHESS_H
52 
53 #include <iostream>
54 #include <vector>
55 #include <string>
56 #include <fstream>
57 #include <windows.h> // for console text colors
58 
59 using namespace std;
60  // to indicate that global variables are defined here (doxygen documentation)
62 
64 #define GREEN 10
65 
67 #define CYAN 11
68 
70 #define RED 12
71 
73 #define PINK 13
74 
76 #define YELLOW 14
77 
79 #define DEFAULT 15
80 
86 enum pieceType
87 {
88  PAWN,
91  ROOK,
93  KING,
94  EMPTY
95 };
96 
103 {
106  WHITE
107 };
108 
109 // forward declaration
110 class Piece;
111 
112 /*************************************************************************************/
113 /* CHESS CLASS - MEMBER FUNCTIONS */
114 /*************************************************************************************/
120 class Chess
121 {
122 public:
127  Chess();
128 
129  /*********************************** BIG THREE *********************************/
134  ~Chess();
135 
142  Chess(const Chess &chess_object);
143 
152  Chess & operator =(const Chess &chess_object);
153  /************************************* END *************************************/
154 
155  /************************ MUTATOR & ACCESSOR FUNCTIONS ************************/
162  vector<Piece*> getBoard() const {return board;}
163 
170  void setBoard(const vector<Piece*> &board) {this->board = board;}
171 
177  vector<Piece*> getCheckPieces() const {return check_pieces;}
178 
185  void setCheckPieces(const vector<Piece*> &check_pieces) {this->check_pieces = check_pieces;}
186 
192  bool getCheck() const {return flags[0];}
193 
199  void setCheck(bool check) {flags[0] = check;}
200 
206  bool getDoubleCheck() const {return flags[1];}
207 
213  void setDoubleCheck(bool double_check) {flags[1] = double_check;}
214 
220  bool getCheckmate() const {return flags[2];}
221 
227  void setCheckmate(bool checkmate) {flags[2] = checkmate;}
228 
234  bool getStalemate() const {return flags[3];}
235 
241  void setStalemate(bool stalemate) {flags[3] = stalemate;}
242 
248  pieceColor getTurn() const {return turn;}
249 
255  void setTurn(pieceColor turn) {this->turn = turn;}
256 
262  int getNumMoves() const { return num_moves;}
263 
269  void setNumMoves(int num_moves) {this->num_moves = num_moves;}
270 
271  /*************************************************************************************/
272  /* CHESSCAMO RESERVOIR FUNCTIONALITY */
273  /*************************************************************************************/
279  vector<pair<int, char>> getReservoir() const {return reservoir;}
280 
287  void setReservoir(const vector<pair<int, char>> & reservoir) {this->reservoir = reservoir;}
288 
300  bool useReservoirPiece(int src, int dest);
301  /************************************* END *************************************/
302 
313  void boardInit();
314 
333  bool makeMove(int src, int dest, istream &in);
334 
347  void isCheckmate(string check_type);
348 
360  bool isStalemate();
361 
370  friend ostream & operator << (ostream &out, const Chess &chess_object);
371 
380  friend istream & operator >> (istream &in, Chess &chess_object);
381 
382 private:
384  vector<Piece*> board;
385 
387  vector<Piece*> check_pieces;
388 
390  vector<bool> flags;
391 
393  vector<pair<int, char>> reservoir;
394 
397 
399  int num_moves;
400 
401  /*************************************************************************************/
402  /* PIECE CLASS - HELPER FUNCTIONS */
403  /*************************************************************************************/
418  void makeMoveForType(int src, int dest);
419 
432  void pieceSwap(int src, int dest, vector<Piece*> &board);
433 
442  void handleChangeTurn();
443 
454  void handleCheckmate();
455 
464  void handleStalemate();
465 
481  bool singleCheckPieceIterator(Piece *piece, Piece *king);
482 
497  bool doubleCheckPieceIterator(Piece *king);
498 
509  pieceColor switchTurn();
510 };
511 
512 /*************************************************************************************/
513 /* PIECE CLASS - MEMBER FUNCTIONS */
514 /*************************************************************************************/
521 class Piece
522 {
523 public:
524  virtual ~Piece() {}
531  Piece() : square{0}, moved{false}, type{EMPTY}, color{NEUTRAL} {}
532 
543  Piece(int square, pieceType type, pieceColor color)
544  : moved{false}
545  {
546  this->square = square;
547  this->type = type;
548  this->color = color;
549  }
550 
551  /************************ MUTATOR & ACCESSOR FUNCTIONS ************************/
557  int getPieceSquare() const {return square;}
558 
564  void setPieceSquare(int square) {this->square = square;}
565 
571  pieceType getPieceType() const {return type;}
572 
578  void setPieceType(pieceType type) {this->type = type;}
579 
585  pieceColor getPieceColor() const {return color;}
586 
592  void setPieceColor(pieceColor color) {this->color = color;}
593 
599  bool getPieceMoveInfo() const {return moved;}
600 
606  void setPieceMoveInfo(bool moved) {this->moved = moved;}
607 
613  virtual bool getEnPassantLeft() const {return false;}
614 
624  virtual void setEnPassantLeft(bool en_passant_left) {}
625 
632  virtual bool getEnPassantRight() const {return false;}
633 
643  virtual void setEnPassantRight(bool en_passant_right) {}
644  /************************************* END *************************************/
645 
646  /************************ TYPE DETERMINATION FUNCTIONS *************************/
652  bool isEmpty() {return this->getPieceType() == EMPTY;}
653 
662  bool isPawn() {return this->getPieceType() == PAWN;}
663 
672  bool isKnight() {return this->getPieceType() == KNIGHT;}
673 
682  bool isBishop() {return this->getPieceType() == BISHOP;}
683 
692  bool isRook() {return this->getPieceType() == ROOK;}
693 
702  bool isQueen() {return this->getPieceType() == QUEEN;}
703 
712  bool isKing() {return this->getPieceType() == KING;}
713  /************************************* END *************************************/
714 
715  /************************ COLOR DETERMINATION FUNCTIONS ************************/
721  bool isPieceWhite() {return this->getPieceColor() == WHITE;}
722 
728  bool isPieceBlack() {return this->getPieceColor() == BLACK;}
729  /************************************* END *************************************/
739  bool isSameColor(int dest, const Chess &chess);
740 
752  bool isPinned(int dest, const Chess &chess);
753 
764  bool isPathFree(int dest, const Chess &chess);
765 
777  bool isLegalMove(int dest, Chess &chess);
778 
788  bool causeCheck(int dest, Chess &chess);
789 
800  bool causeDoubleCheck(int dest, Chess &chess);
801 
813  virtual bool isPossibleMove(int dest, const Chess &chess) {return false;}
814 
828  virtual void enPassantHandling(int src, Chess &chess) {return;}
829 
841  virtual void promotePawn(Chess &chess, istream &in) {return;}
842 
852  virtual bool canCastle(int dest, const Chess &chess) {return false;}
853 
863  virtual bool movedIntoCheck(int dest, Chess &chess) {return false;}
864 
865 private:
867  int square;
868 
870  bool moved;
871 
876 
881 };
882 
883 /*************************************************************************************/
884 /* PAWN CLASS - MEMBER FUNCTIONS */
885 /*************************************************************************************/
890 class Pawn : public Piece
891 {
892 public:
893  ~Pawn() {}
894 
903  Pawn() : Piece(), en_passant_left{false}, en_passant_right{false} {}
904 
905  // constructor with valid piece information initialization
906 
918  Pawn(int square, pieceType type, pieceColor color)
919  : Piece(square, type, color), en_passant_left{false}, en_passant_right{false} {}
920 
921  /************************ MUTATOR & ACCESSOR FUNCTIONS ************************/
922  // En-passant ability information (LEFT)
923  bool getEnPassantLeft() const override {return en_passant_left;}
924  void setEnPassantLeft(bool en_passant_left) override {this->en_passant_left = en_passant_left;}
925 
926  // En-passant ability information (RIGHT)
927  bool getEnPassantRight() const override {return en_passant_right;}
928  void setEnPassantRight(bool en_passant_right) override {this->en_passant_right = en_passant_right;}
929  /************************************* END *************************************/
930 
944  bool isPossibleMove(int dest, const Chess &chess) override;
945 
954  void enPassantHandling(int src, Chess &chess) override;
955 
965  void promotePawn(Chess &chess, istream &in) override;
966 
967 private:
970 
973 };
974 
975 /*************************************************************************************/
976 /* KNIGHT CLASS - MEMBER FUNCTIONS */
977 /*************************************************************************************/
982 class Knight : public Piece
983 {
984 public:
985  ~Knight() {}
986 
994  Knight() : Piece() {}
995 
1007  Knight(int square, pieceType type, pieceColor color) : Piece(square, type, color) {}
1008 
1022  bool isPossibleMove(int dest, const Chess &chess) override;
1023 };
1024 
1025 /*************************************************************************************/
1026 /* BISHOP CLASS - MEMBER FUNCTIONS */
1027 /*************************************************************************************/
1032 class Bishop : public Piece
1033 {
1034 public:
1035  ~Bishop() {}
1036 
1044  Bishop() : Piece() {}
1045 
1057  Bishop(int square, pieceType type, pieceColor color) : Piece(square, type, color) {}
1058 
1065  bool isPossibleMove(int dest, const Chess &chess) override;
1066 };
1067 
1068 /*************************************************************************************/
1069 /* ROOK CLASS - MEMBER FUNCTIONS */
1070 /*************************************************************************************/
1074 class Rook : public Piece
1075 {
1076 public:
1077  ~Rook() {}
1078 
1086  Rook() : Piece() {}
1087 
1099  Rook(int square, pieceType type, pieceColor color) : Piece(square, type, color) {}
1100 
1113  bool isPossibleMove(int dest, const Chess &chess) override;
1114 };
1115 
1116 /*************************************************************************************/
1117 /* QUEEN CLASS - MEMBER FUNCTIONS */
1118 /*************************************************************************************/
1122 class Queen : public Piece
1123 {
1124 public:
1125  ~Queen() {}
1126 
1134  Queen() : Piece() {}
1135 
1147  Queen(int square, pieceType type, pieceColor color) : Piece(square, type, color) {}
1148 
1161  bool isPossibleMove(int dest, const Chess &chess) override;
1162 };
1163 
1164 /*************************************************************************************/
1165 /* KING CLASS - MEMBER FUNCTIONS */
1166 /*************************************************************************************/
1171 class King : public Piece
1172 {
1173 public:
1174  ~King() {}
1175 
1183  King() : Piece() {}
1184 
1196  King(int square, pieceType type, pieceColor color) : Piece(square, type, color) {}
1197 
1210  bool isPossibleMove(int dest, const Chess &chess) override;
1211 
1222  bool canCastle(int dest, const Chess &chess) override;
1223 
1235  bool movedIntoCheck(int dest, Chess &chess) override;
1236 };
1237 
1238 /*************************************************************************************/
1239 /* EMPTY CLASS - MEMBER FUNCTIONS */
1240 /*************************************************************************************/
1245 class Empty : public Piece
1246 {
1247 public:
1248  ~Empty() {}
1249 
1257  Empty() : Piece() {}
1258 
1270  Empty(int square, pieceType type, pieceColor color) : Piece(square, type, color) {}
1271 };
1272 
1273 /*************************************************************************************/
1274 /* GLOBAL FUNCTIONS / OBJECTS */
1275 /*************************************************************************************/
1281 namespace chessCAMO
1282 {
1296  template<class T>
1297  int preProcessInput(T input)
1298  {
1299  if(std::isalpha(input[0]) && input.length() > 1)
1300  {
1301  int ascii_val = std::islower(input[0]) ? 97 : 65;
1302  return (int(input[0]) - ascii_val) + (8 - (int(input[1]) - 48))*8; // file + rank
1303  }
1304 
1305  // piece from reservoir?
1306  else if(std::isalpha(input[0]))
1307  return (unsigned char) std::tolower(input[0]);
1308 
1309  else { return std::stoi(input); }
1310  }
1311 
1324  void printBoard(const vector<Piece*> &board, const vector<pair<int, char>> &reservoir);
1325 
1333  void printFooterMessage(string input_message, const Chess &chess);
1334 
1348  void drawOrResign(bool clear_screen, Chess &chess, istream &in);
1349 
1362  void printMessage(string text, int color);
1363 
1370  void clearScreen(bool apply);
1371 
1378  void saveObject(const Chess &chess_object);
1379 
1387  void restoreObject(Chess &chess_object);
1388 } // end namespace chessCAMO
1389 
1390 #endif // CHESS_H
1391 
1392 // main page of doxygen documentation file
1393 
Chess::flags
vector< bool > flags
Definition: chess.h:390
Piece::setPieceMoveInfo
void setPieceMoveInfo(bool moved)
(Mutator) Sets the piece move information.
Definition: chess.h:606
Piece::isKing
bool isKing()
Determines if the piece is a king.
Definition: chess.h:712
Empty::Empty
Empty()
Default constructor with default board parameter initialization - Constructs a new instance....
Definition: chess.h:1257
KNIGHT
@ KNIGHT
1
Definition: chess.h:89
Piece::promotePawn
virtual void promotePawn(Chess &chess, istream &in)
Promotes the pawn if needed.
Definition: chess.h:841
Empty::~Empty
~Empty()
Definition: chess.h:1248
KING
@ KING
5
Definition: chess.h:93
Chess::getCheckPieces
vector< Piece * > getCheckPieces() const
(Accessor) Gets the check stack information.
Definition: chess.h:177
BLACK
@ BLACK
0
Definition: chess.h:104
chessCAMO::drawOrResign
void drawOrResign(bool clear_screen, Chess &chess, istream &in)
At any moment, the players can either continue, draw, or resign.
Definition: chess.cpp:1732
Chess::getCheckmate
bool getCheckmate() const
(Accessor) Gets the checkmate information.
Definition: chess.h:220
Bishop
This class describes a bishop and provides functions related to bishop movements.
Definition: chess.h:1033
Chess::setStalemate
void setStalemate(bool stalemate)
(Mutator) Sets the stalemate information.
Definition: chess.h:241
Rook::~Rook
~Rook()
Definition: chess.h:1077
Piece::color
pieceColor color
Definition: chess.h:880
chessCAMO::saveObject
void saveObject(const Chess &chess_object)
Saves an object by serializing its member fields to a text file, allowing it to later be reset.
Definition: chess.cpp:1843
Piece::~Piece
virtual ~Piece()
Definition: chess.h:524
chessCAMO::printBoard
void printBoard(const vector< Piece * > &board, const vector< pair< int, char >> &reservoir)
Iterates through the pieces on a current board representation to produce the board on the console scr...
Definition: chess.cpp:1619
Knight::Knight
Knight(int square, pieceType type, pieceColor color)
Constructs a new instance with valid piece information initialization. Calls Piece class constructor ...
Definition: chess.h:1007
Queen::~Queen
~Queen()
Definition: chess.h:1125
Chess::setDoubleCheck
void setDoubleCheck(bool double_check)
(Mutator) Sets the double check information.
Definition: chess.h:213
Chess
This class describes the chess board on which the game takes place. It contains functions which analy...
Definition: chess.h:121
Chess::num_moves
int num_moves
Definition: chess.h:399
Piece::movedIntoCheck
virtual bool movedIntoCheck(int dest, Chess &chess)
Did the king move into check?
Definition: chess.h:863
Chess::setTurn
void setTurn(pieceColor turn)
(Mutator) Sets the player's turn information.
Definition: chess.h:255
chessCAMO::restoreObject
void restoreObject(Chess &chess_object)
De-serializes an object from a file based on the number of moves made, essentially restoring the obje...
Definition: chess.cpp:1858
NEUTRAL
@ NEUTRAL
1
Definition: chess.h:105
Chess::getNumMoves
int getNumMoves() const
(Accessor) Gets the number of moves made.
Definition: chess.h:262
King::~King
~King()
Definition: chess.h:1174
Piece::isBishop
bool isBishop()
Determines if the piece is a bishop.
Definition: chess.h:682
Piece::getEnPassantRight
virtual bool getEnPassantRight() const
(Accessor) Gets the piece en-passant ability information for right side.
Definition: chess.h:632
Rook::Rook
Rook()
Default constructor with default board parameter initialization - Constructs a new instance....
Definition: chess.h:1086
Pawn::en_passant_left
bool en_passant_left
Definition: chess.h:969
King::King
King(int square, pieceType type, pieceColor color)
Constructs a new instance with valid piece information initialization. Calls Piece class constructor ...
Definition: chess.h:1196
Piece::getEnPassantLeft
virtual bool getEnPassantLeft() const
(Accessor) Gets the piece en-passant ability information for left side.
Definition: chess.h:613
Knight::Knight
Knight()
Default constructor with default board parameter initialization - Constructs a new instance....
Definition: chess.h:994
Piece::isRook
bool isRook()
Determines if the piece is a rook.
Definition: chess.h:692
Chess::getCheck
bool getCheck() const
(Accessor) Gets the check information.
Definition: chess.h:192
Chess::setBoard
void setBoard(const vector< Piece * > &board)
(Mutator) Updates the board representation at the top of the board positions stack.
Definition: chess.h:170
chessCAMO::printMessage
void printMessage(string text, int color)
Prints the given message ('text') with a given 'color' to console.
Definition: chess.cpp:1830
Piece::isPossibleMove
virtual bool isPossibleMove(int dest, const Chess &chess)
Determine if the piece has a possible move towards the destination square.
Definition: chess.h:813
Piece::setEnPassantLeft
virtual void setEnPassantLeft(bool en_passant_left)
(Mutator) Sets the piece en-passant ability information for left side.
Definition: chess.h:624
Chess::getTurn
pieceColor getTurn() const
(Accessor) Gets the player's turn information.
Definition: chess.h:248
Piece::isKnight
bool isKnight()
Determines if the piece is a knight.
Definition: chess.h:672
Piece::setPieceSquare
void setPieceSquare(int square)
(Mutator) Sets the piece square information.
Definition: chess.h:564
Piece::getPieceMoveInfo
bool getPieceMoveInfo() const
(Accessor) Gets the piece move information useful for pawns, rooks, kings.
Definition: chess.h:599
Piece::setPieceType
void setPieceType(pieceType type)
(Mutator) Sets the piece type information.
Definition: chess.h:578
Pawn::~Pawn
~Pawn()
Definition: chess.h:893
Pawn::setEnPassantLeft
void setEnPassantLeft(bool en_passant_left) override
(Mutator) Sets the piece en-passant ability information for left side.
Definition: chess.h:924
Piece::moved
bool moved
Definition: chess.h:870
chessCAMO::clearScreen
void clearScreen(bool apply)
Clears the screen of the console window using a special string instead of a platform specific command...
Definition: chess.cpp:1815
Bishop::~Bishop
~Bishop()
Definition: chess.h:1035
operator<<
ostream & operator<<(ostream &out, const Chess &chess_object)
Overloaded extraction operator.
Definition: chess.cpp:47
Chess::getReservoir
vector< pair< int, char > > getReservoir() const
Gets the current reservoir information (pieces and quantity).
Definition: chess.h:279
King
This class describes a king and provides functions related to king movements.
Definition: chess.h:1172
Pawn
This class describes a pawn and provides functions related to pawn movements.
Definition: chess.h:891
Empty::Empty
Empty(int square, pieceType type, pieceColor color)
Constructs a new instance with valid piece information initialization. Calls Piece class constructor ...
Definition: chess.h:1270
Chess::setCheck
void setCheck(bool check)
(Mutator) Sets the check information.
Definition: chess.h:199
Piece::setPieceColor
void setPieceColor(pieceColor color)
(Mutator) Sets the piece color information.
Definition: chess.h:592
Chess::getDoubleCheck
bool getDoubleCheck() const
(Accessor) Gets the double check information.
Definition: chess.h:206
pieceType
pieceType
Piece's Type.
Definition: chess.h:87
chessCAMO::preProcessInput
int preProcessInput(T input)
Converts the input string into its corresponding coordinate (integer) for easier computation in chess...
Definition: chess.h:1297
Pawn::getEnPassantRight
bool getEnPassantRight() const override
(Accessor) Gets the piece en-passant ability information for right side.
Definition: chess.h:927
Chess::setCheckmate
void setCheckmate(bool checkmate)
(Mutator) Sets the checkmate information.
Definition: chess.h:227
Pawn::Pawn
Pawn()
Default constructor with default board parameter initialization - Constructs a new instance....
Definition: chess.h:903
Piece::getPieceColor
pieceColor getPieceColor() const
(Accessor) Gets the piece color information.
Definition: chess.h:585
Chess::getStalemate
bool getStalemate() const
(Accessor) Gets the stalemate information.
Definition: chess.h:234
Piece::setEnPassantRight
virtual void setEnPassantRight(bool en_passant_right)
(Mutator) Sets the piece en-passant ability information for right side.
Definition: chess.h:643
BISHOP
@ BISHOP
2
Definition: chess.h:90
PAWN
@ PAWN
0
Definition: chess.h:88
Piece::isPieceBlack
bool isPieceBlack()
Determines if the piece is black.
Definition: chess.h:728
Knight
This class describes a knight and provides functions related to knight movements.
Definition: chess.h:983
Chess::reservoir
vector< pair< int, char > > reservoir
Definition: chess.h:393
pieceColor
pieceColor
Piece's Color.
Definition: chess.h:103
Empty
This class describes an empty square which is necessary to keep in mind when playing a game of chess.
Definition: chess.h:1246
Piece::square
int square
Definition: chess.h:867
Queen::Queen
Queen()
Default constructor with default board parameter initialization - Constructs a new instance....
Definition: chess.h:1134
operator>>
istream & operator>>(istream &in, Chess &chess_object)
Overloaded insertion operator.
Definition: chess.cpp:71
Piece::type
pieceType type
Definition: chess.h:875
Rook::Rook
Rook(int square, pieceType type, pieceColor color)
Constructs a new instance with valid piece information initialization. Calls Piece class constructor ...
Definition: chess.h:1099
Queen::Queen
Queen(int square, pieceType type, pieceColor color)
Constructs a new instance with valid piece information initialization. Calls Piece class constructor ...
Definition: chess.h:1147
King::King
King()
Default constructor with default board parameter initialization - Constructs a new instance....
Definition: chess.h:1183
Piece::isQueen
bool isQueen()
Determines if the piece is a queen.
Definition: chess.h:702
WHITE
@ WHITE
2
Definition: chess.h:106
Chess::setCheckPieces
void setCheckPieces(const vector< Piece * > &check_pieces)
(Mutator) Sets the check stack information.
Definition: chess.h:185
Bishop::Bishop
Bishop(int square, pieceType type, pieceColor color)
Constructs a new instance with valid piece information initialization. Calls Piece class constructor ...
Definition: chess.h:1057
Chess::board
vector< Piece * > board
Definition: chess.h:384
Piece::isEmpty
bool isEmpty()
Determines if the square is empty.
Definition: chess.h:652
Pawn::getEnPassantLeft
bool getEnPassantLeft() const override
(Accessor) Gets the piece en-passant ability information for left side.
Definition: chess.h:923
Bishop::Bishop
Bishop()
Default constructor with default board parameter initialization - Constructs a new instance....
Definition: chess.h:1044
Piece::Piece
Piece(int square, pieceType type, pieceColor color)
Constructs a new instance with valid piece information initialization.
Definition: chess.h:543
Rook
This class describes a rook and provides functions related to rook movements.
Definition: chess.h:1075
Piece::getPieceType
pieceType getPieceType() const
(Accessor) Gets the piece type information.
Definition: chess.h:571
Piece::Piece
Piece()
Default constructor with default board parameter initialization - Constructs a new instance.
Definition: chess.h:531
Piece::enPassantHandling
virtual void enPassantHandling(int src, Chess &chess)
Pawn attacks opposing pawn with en-passant
Definition: chess.h:828
Pawn::Pawn
Pawn(int square, pieceType type, pieceColor color)
Constructs a new instance with valid piece information initialization. Calls Piece class constructor ...
Definition: chess.h:918
QUEEN
@ QUEEN
4
Definition: chess.h:92
ROOK
@ ROOK
3
Definition: chess.h:91
EMPTY
@ EMPTY
6
Definition: chess.h:94
Chess::setReservoir
void setReservoir(const vector< pair< int, char >> &reservoir)
Sets the piece reservoir after a piece on the current board representation is replaced.
Definition: chess.h:287
Piece::getPieceSquare
int getPieceSquare() const
(Accessor) Gets the piece square information.
Definition: chess.h:557
Queen
This class describes a queen and provides functions related to queen movements.
Definition: chess.h:1123
Knight::~Knight
~Knight()
Definition: chess.h:985
Piece::isPawn
bool isPawn()
Determines if the piece is a pawn.
Definition: chess.h:662
Chess::turn
pieceColor turn
Definition: chess.h:396
chessCAMO::printFooterMessage
void printFooterMessage(string input_message, const Chess &chess)
Prints the footer message before each move indicating whose move it is for the current board represen...
Definition: chess.cpp:1712
Piece::isPieceWhite
bool isPieceWhite()
Determines if the piece is white.
Definition: chess.h:721
Pawn::setEnPassantRight
void setEnPassantRight(bool en_passant_right) override
(Mutator) Sets the piece en-passant ability information for right side.
Definition: chess.h:928
Chess::getBoard
vector< Piece * > getBoard() const
(Accessor) Gets the board representation at the top of the board positions stack.
Definition: chess.h:162
Pawn::en_passant_right
bool en_passant_right
Definition: chess.h:972
chessCAMO
This namespace contains the global functions related to chessCAMO which are mainly used as helper fun...
Definition: chess.h:1282
Chess::setNumMoves
void setNumMoves(int num_moves)
(Mutator) Sets the number of moves made on the board.
Definition: chess.h:269
Piece
This class describes the pieces on the board at any given moment. It contains functions for determini...
Definition: chess.h:522
Chess::check_pieces
vector< Piece * > check_pieces
Definition: chess.h:387
Piece::canCastle
virtual bool canCastle(int dest, const Chess &chess)
Can the king castle?
Definition: chess.h:852