#ifndef CHESSY_BOARD_H #define CHESSY_BOARD_H #include "BitBoard.h" #include "MoveGeneration.h" #include namespace chessy { enum PieceType : int; class Board; } enum chessy::PieceType : int { EMPTY = -1, PAWN = 0, KNIGHT = 1, BISHOP = 2, ROOK = 3, QUEEN = 4, KING = 5 }; class chessy::Board { Bitboard whites[6]; Bitboard blacks[6]; public: Board(void) = default; Board(const Board&) = default; ~Board(void) = default; /*! * resets the board to the chess starting position. */ void resetBoard(void); void setEmpty(void); private: bool tryToMove(Bitboard start, Bitboard end, Bitboard& b); public: Bitboard getWhitePawns (void) const { return whites[PAWN]; } Bitboard getWhiteKnights(void) const { return whites[KNIGHT]; } Bitboard getWhiteBishops(void) const { return whites[BISHOP]; } Bitboard getWhiteRooks (void) const { return whites[ROOK]; } Bitboard getWhiteQueens (void) const { return whites[QUEEN]; } Bitboard getWhiteKings (void) const { return whites[KING]; } Bitboard getBlackPawns (void) const { return blacks[PAWN]; } Bitboard getBlackKnights(void) const { return blacks[KNIGHT]; } Bitboard getBlackBishops(void) const { return blacks[BISHOP]; } Bitboard getBlackRooks (void) const { return blacks[ROOK]; } Bitboard getBlackQueens (void) const { return blacks[QUEEN]; } Bitboard getBlackKings (void) const { return blacks[KING]; } /*! * parses the first part of a FEN string and sets the board * to the accourding position */ void setBoard(const std::string& fenPosition); std::string getFenBoard(void) const; PieceType getWhiteAtPosition(Index i) const; PieceType getBlackAtPosition(Index i) const; /*! * applies a move to the board */ void applyMove(const Move& move); /*! * \return * a bitboard where every field occupied by a white piece * is 1, every free field 0 */ Bitboard getWhites(void) const; /*! * \return * a bitboard where every field occupied by a black piece * is 1, every free field 0 */ Bitboard getBlacks(void) const; /*! * \return * a bitboard where every field occupied by any piece * is 1, every free field 0 */ Bitboard getOccupied(void) const; /*! * \return * a bitboard where every field occupied by any piece * is 0, every free field 1 */ Bitboard getFree(void) const; }; #endif // CHESSY_BOARD_H