]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Restore deterministic search state
[stockfish] / src / search.cpp
index 18e0cb95af9abaa1cb15a03d7ae173fdeb3f87fc..152e9fd68c4812854d0ce3d098581586fb56102f 100644 (file)
@@ -181,6 +181,18 @@ void Search::init() {
 }
 
 
+/// Search::reset() clears all search memory, to restore a deterministic state
+
+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<bool Root>
@@ -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"]);