X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fsearch.cpp;h=d419cd30ede15e192142b040de9caf14d8b8005c;hb=ee0371f86e319aa24bc1d32f02d9495eea79aa72;hp=18e0cb95af9abaa1cb15a03d7ae173fdeb3f87fc;hpb=578b21bbeedc41b6e0d1b2df46887b1636a78e2b;p=stockfish diff --git a/src/search.cpp b/src/search.cpp index 18e0cb95..d419cd30 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -181,6 +181,18 @@ void Search::init() { } +/// Search::reset() clears all search memory, to obtain reproducible search results + +void Search::reset () { + + TT.clear(); + History.clear(); + CounterMovesHistory.clear(); + Gains.clear(); + Countermoves.clear(); +} + + /// Search::perft() is our utility to verify move generation. All the leaf nodes /// up to the given depth are generated and counted and the sum returned. template @@ -339,10 +351,6 @@ namespace { beta = VALUE_INFINITE; TT.new_search(); - History.clear(); - CounterMovesHistory.clear(); - Gains.clear(); - Countermoves.clear(); size_t multiPV = Options["MultiPV"]; Skill skill(Options["Skill Level"]); @@ -850,7 +858,7 @@ moves_loop: // When in check and at SpNode search starts from here captureOrPromotion = pos.capture_or_promotion(move); givesCheck = type_of(move) == NORMAL && !ci.dcCandidates - ? ci.checkSq[type_of(pos.piece_on(from_sq(move)))] & to_sq(move) + ? ci.checkSquares[type_of(pos.piece_on(from_sq(move)))] & to_sq(move) : pos.gives_check(move, ci); dangerous = givesCheck @@ -1273,7 +1281,7 @@ moves_loop: // When in check and at SpNode search starts from here assert(is_ok(move)); givesCheck = type_of(move) == NORMAL && !ci.dcCandidates - ? ci.checkSq[type_of(pos.piece_on(from_sq(move)))] & to_sq(move) + ? ci.checkSquares[type_of(pos.piece_on(from_sq(move)))] & to_sq(move) : pos.gives_check(move, ci); // Futility pruning