From 6ce225bb4c31298b131714eff67b56de3b8ee78d Mon Sep 17 00:00:00 2001 From: Joost VandeVondele Date: Sun, 5 Mar 2023 17:26:12 +0100 Subject: [PATCH] Fix TB after capture_stage fix https://github.com/official-stockfish/Stockfish/commit/5c75c1c2fbb7bb4f0bf7c44fb855c415b788cbf7 introduced a capture_stage() function, but TB usage needs a pure capture() function. closes https://github.com/official-stockfish/Stockfish/pull/4428 No functional change. --- src/position.h | 11 ++++++++--- src/syzygy/tbprobe.cpp | 4 ++-- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/position.h b/src/position.h index 485540ef..1fc6b3b8 100644 --- a/src/position.h +++ b/src/position.h @@ -125,6 +125,7 @@ public: // Properties of moves bool legal(Move m) const; bool pseudo_legal(const Move m) const; + bool capture(Move m) const; bool capture_stage(Move m) const; bool gives_check(Move m) const; Piece moved_piece(Move m) const; @@ -381,14 +382,18 @@ inline bool Position::is_chess960() const { return chess960; } +inline bool Position::capture(Move m) const { + assert(is_ok(m)); + return (!empty(to_sq(m)) && type_of(m) != CASTLING) + || type_of(m) == EN_PASSANT; +} + // returns true if a move is generated from the capture stage // having also queen promotions covered, i.e. consistency with the capture stage move generation // is needed to avoid the generation of duplicate moves. inline bool Position::capture_stage(Move m) const { assert(is_ok(m)); - return (!empty(to_sq(m)) && type_of(m) != CASTLING) - || (type_of(m) == PROMOTION && promotion_type(m) == QUEEN) - || type_of(m) == EN_PASSANT; + return capture(m) || (type_of(m) == PROMOTION && promotion_type(m) == QUEEN); } inline Piece Position::captured_piece() const { diff --git a/src/syzygy/tbprobe.cpp b/src/syzygy/tbprobe.cpp index 2a9e1b68..b594ac37 100644 --- a/src/syzygy/tbprobe.cpp +++ b/src/syzygy/tbprobe.cpp @@ -1203,7 +1203,7 @@ WDLScore search(Position& pos, ProbeState* result) { for (const Move move : moveList) { - if ( !pos.capture_stage(move) + if ( !pos.capture(move) && (!CheckZeroingMoves || type_of(pos.moved_piece(move)) != PAWN)) continue; @@ -1472,7 +1472,7 @@ int Tablebases::probe_dtz(Position& pos, ProbeState* result) { for (const Move move : MoveList(pos)) { - bool zeroing = pos.capture_stage(move) || type_of(pos.moved_piece(move)) == PAWN; + bool zeroing = pos.capture(move) || type_of(pos.moved_piece(move)) == PAWN; pos.do_move(move, st); -- 2.39.2