1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- #ifndef CHESSY_CHESSGAME_H
- #define CHESSY_CHESSGAME_H
- #include <vector>
- #include <string>
- #include "Board.h"
- namespace chessy
- {
- class ChessGame;
- }
- class chessy::ChessGame
- {
- Board board;
- bool canCastleQueenSide[2] = { true, true };
- bool canCastleKingSide [2] = { true, true };
- short reversibleHalfMoves = 0;
-
- Index enPassant = -1;
- Side turn = WHITE_SIDE;
- int moveCount = 1;
- public:
- ChessGame(void);
- ChessGame(const std::string& fenString);
- ChessGame(const ChessGame&) = default;
- ~ChessGame(void) = default;
- bool isValidMove(const Move& move) const;
- std::vector<Move> getValidMoves(void) const;
- inline const Board& getBoard(void) const { return board; }
- inline Board& getBoard(void) { return board; }
- inline bool getCanCastleKingSide(Side side) const
- {
- return canCastleKingSide[side];
- }
- inline bool getCanCastleQueenSide(Side side) const
- {
- return canCastleQueenSide[side];
- }
- void move(Move move);
- inline Side getTurn(void) const { return turn; }
- void loadFromFen(const std::string& fenString);
- std::string generateFen(void) const;
- };
- #endif
|