From ca365f17baec20ec26865efec169e28e28c966d8 Mon Sep 17 00:00:00 2001 From: Tomasz Sobczyk Date: Mon, 24 May 2021 19:17:19 +0200 Subject: [PATCH] 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 --- src/extra/nnue_data_binpack_format.h | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/extra/nnue_data_binpack_format.h b/src/extra/nnue_data_binpack_format.h index dce53b83..b2597d76 100644 --- a/src/extra/nnue_data_binpack_format.h +++ b/src/extra/nnue_data_binpack_format.h @@ -6078,18 +6078,14 @@ namespace chess // for double pushes move index differs by 16 or -16; if((movedPiece == PieceType::Pawn) & ((ordinal(move.to) ^ ordinal(move.from)) == 16)) { - const Square potentialEpSquare = fromOrdinal((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; - } + m_epSquare = fromOrdinal((ordinal(move.to) + ordinal(move.from)) >> 1); } const Piece captured = BaseType::doMove(move); m_sideToMove = !m_sideToMove; + + nullifyEpSquareIfNotPossible(); + return { move, captured, oldEpSquare, oldCastlingRights }; }