[Board] Implement castlingRights and enPassantSquare

This commit is contained in:
2022-12-21 10:42:28 +01:00
parent 123e473a53
commit 0084bbf994
2 changed files with 6 additions and 4 deletions

View File

@@ -41,19 +41,19 @@ PieceColor Board::turn() const {
}
void Board::setCastlingRights(CastlingRights cr) {
(void) cr;
mCr = cr;
}
CastlingRights Board::castlingRights() const {
return CastlingRights::None;
return mCr;
}
void Board::setEnPassantSquare(const Square::Optional &square) {
(void) square;
mEPS = square->index();
}
Square::Optional Board::enPassantSquare() const {
return std::nullopt;
return Square::fromIndex(mEPS);
}
void Board::makeMove(const Move &move) {

View File

@@ -40,6 +40,8 @@ private:
BitBoard mPieceBBs[BB_NUM] = {};
PieceColor mTurn = PieceColor::White;
CastlingRights mCr;
unsigned mEPS = 64;
static inline void clearIndex(BitBoard &b, unsigned i) {
b &= ~(1ULL << i);