[Board] Reformat handlePawnDoubleAdvance

This commit is contained in:
2022-12-22 10:41:00 +01:00
parent defd74fb63
commit fbc1a5589a

View File

@@ -132,13 +132,18 @@ void Board::handlePawnDoubleAdvance(const Move &move, BitBoard bb, const Piece &
if (movedPiece.type() == PieceType::Pawn) { if (movedPiece.type() == PieceType::Pawn) {
auto fromR = move.from().rank(); auto fromR = move.from().rank();
auto toR = move.to().rank(); auto toR = move.to().rank();
auto diff = abs(static_cast<int>(fromR) - static_cast<int>(toR)); if (abs(static_cast<int>(fromR) - static_cast<int>(toR)) == 2) {
if (diff == 2 && (mPieceBBs[toIndex(PieceType::Pawn)] & (bb.left(1) | bb.right(1)) & BitBoard::getRank(static_cast<int>(toR)))) { if (mPieceBBs[toIndex(PieceType::Pawn)]
& (bb.left(1) | bb.right(1))
& BitBoard::getRank(static_cast<int>(toR))) {
mEPS = Square::fromCoordinates(move.to().file(), std::max(fromR, toR) - 1); mEPS = Square::fromCoordinates(move.to().file(), std::max(fromR, toR) - 1);
return; return;
} }
} }
}
mEPS = std::nullopt; mEPS = std::nullopt;
} }