mirror of
https://github.com/opelly27/Stockfish.git
synced 2026-05-20 08:37:44 +00:00
Fix discrepancy for ep square between set and move in the binpack lib.
basically, the binpack lib doesn't reset the epsquare after f7f5 in this 5kb1/5p2/2B3p1/1N1KP2p/3p1P2/2bP2P1/5r2/8 b - - 0 1 position, but it does reset it when passed the fen 5kb1/8/2B3p1/1N1KPp1p/3p1P2/2bP2P1/5r2/8 w - f6 0 50. Potentially creating a discrepancy based on whether the position was set directly or arrived at by a move
This commit is contained in:
@@ -6078,18 +6078,14 @@ namespace chess
|
|||||||
// for double pushes move index differs by 16 or -16;
|
// for double pushes move index differs by 16 or -16;
|
||||||
if((movedPiece == PieceType::Pawn) & ((ordinal(move.to) ^ ordinal(move.from)) == 16))
|
if((movedPiece == PieceType::Pawn) & ((ordinal(move.to) ^ ordinal(move.from)) == 16))
|
||||||
{
|
{
|
||||||
const Square potentialEpSquare = fromOrdinal<Square>((ordinal(move.to) + ordinal(move.from)) >> 1);
|
m_epSquare = fromOrdinal<Square>((ordinal(move.to) + ordinal(move.from)) >> 1);
|
||||||
// Even though the move has not yet been made we can safely call
|
|
||||||
// this function and get the right result because the position of the
|
|
||||||
// pawn to be captured is not really relevant.
|
|
||||||
if (isEpPossible(potentialEpSquare, !m_sideToMove))
|
|
||||||
{
|
|
||||||
m_epSquare = potentialEpSquare;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Piece captured = BaseType::doMove(move);
|
const Piece captured = BaseType::doMove(move);
|
||||||
m_sideToMove = !m_sideToMove;
|
m_sideToMove = !m_sideToMove;
|
||||||
|
|
||||||
|
nullifyEpSquareIfNotPossible();
|
||||||
|
|
||||||
return { move, captured, oldEpSquare, oldCastlingRights };
|
return { move, captured, oldEpSquare, oldCastlingRights };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user