mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-24 19:16:49 +08:00
Add additional checks for en-passant possiblity when fixing the erroneus ep flag from a fen.
This commit is contained in:
@@ -6115,6 +6115,26 @@ namespace chess
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pieceAt(epSquare) != Piece::none())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
const auto forward =
|
||||
sideToMove == chess::Color::White
|
||||
? FlatSquareOffset(0, 1)
|
||||
: FlatSquareOffset(0, -1);
|
||||
|
||||
if (pieceAt(epSquare + forward) != Piece::none())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pieceAt(epSquare + -forward) != Piece(PieceType::Pawn, !sideToMove))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return isEpPossibleColdPath(epSquare, pawnsAttackingEpSquare, sideToMove);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user