From 0084bbf994794cb68be164c0e9c6240a39f81604 Mon Sep 17 00:00:00 2001 From: Arthur Bols Date: Wed, 21 Dec 2022 10:42:28 +0100 Subject: [PATCH] [Board] Implement castlingRights and enPassantSquare --- Board.cpp | 8 ++++---- Board.hpp | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Board.cpp b/Board.cpp index d084664..204cee3 100644 --- a/Board.cpp +++ b/Board.cpp @@ -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) { diff --git a/Board.hpp b/Board.hpp index d167aca..3b0796a 100644 --- a/Board.hpp +++ b/Board.hpp @@ -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);