]> git.sesse.net Git - stockfish/commitdiff
Fix TB after capture_stage fix
authorJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sun, 5 Mar 2023 16:26:12 +0000 (17:26 +0100)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Wed, 8 Mar 2023 06:14:49 +0000 (07:14 +0100)
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
src/syzygy/tbprobe.cpp

index 485540ef866f9610ae9c1978701764816d90cbbc..1fc6b3b89c4ab2726b9605d5afc50a326e969bfc 100644 (file)
@@ -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 {
index 2a9e1b68d378661dff78e3efe3428ec202e2668e..b594ac3714e5cf3e853289ebd09f0be03f1bd22b 100644 (file)
@@ -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<LEGAL>(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);