mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 14:27:45 +00:00
Merge pull request #3498 from Sopel97/old_fix_again
Add additional checks for en-passant possiblity when fixing the erroneus ep flag from a fen.
This commit is contained in:
@@ -6116,6 +6116,26 @@ namespace chess
|
|||||||
|
|
||||||
[[nodiscard]] inline bool Position::isEpPossibleColdPath(Square epSquare, Bitboard pawnsAttackingEpSquare, Color sideToMove) const
|
[[nodiscard]] inline bool Position::isEpPossibleColdPath(Square epSquare, Bitboard pawnsAttackingEpSquare, Color sideToMove) const
|
||||||
{
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
// only set m_epSquare when it matters, ie. when
|
// only set m_epSquare when it matters, ie. when
|
||||||
// the opposite side can actually capture
|
// the opposite side can actually capture
|
||||||
for (Square sq : pawnsAttackingEpSquare)
|
for (Square sq : pawnsAttackingEpSquare)
|
||||||
|
|||||||
Reference in New Issue
Block a user