diff --git a/Board.cpp b/Board.cpp index ff7369f..6c7e129 100644 --- a/Board.cpp +++ b/Board.cpp @@ -132,11 +132,16 @@ void Board::handlePawnDoubleAdvance(const Move &move, BitBoard bb, const Piece & if (movedPiece.type() == PieceType::Pawn) { auto fromR = move.from().rank(); auto toR = move.to().rank(); - auto diff = abs(static_cast(fromR) - static_cast(toR)); - if (diff == 2 && (mPieceBBs[toIndex(PieceType::Pawn)] & (bb.left(1) | bb.right(1)) & BitBoard::getRank(static_cast(toR)))) { - mEPS = Square::fromCoordinates(move.to().file(), std::max(fromR, toR) - 1); - return; + if (abs(static_cast(fromR) - static_cast(toR)) == 2) { + if (mPieceBBs[toIndex(PieceType::Pawn)] + & (bb.left(1) | bb.right(1)) + & BitBoard::getRank(static_cast(toR))) { + + mEPS = Square::fromCoordinates(move.to().file(), std::max(fromR, toR) - 1); + return; + } } + } mEPS = std::nullopt;