]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Convert History table H in a local variable
[stockfish] / src / search.cpp
index ba5ad365af2f1caffb95fa56caa9004ec1520dc5..cc2a06134d6cf15ce939c7af175a906c9af8c236 100644 (file)
@@ -207,6 +207,9 @@ namespace {
   // Search depth at iteration 1
   const Depth InitialDepth = OnePly /*+ OnePly/2*/;
 
+  // History tables
+  History H;
+
   // Node counters
   int NodesSincePoll;
   int NodesBetweenPolls = 30000;
@@ -330,11 +333,6 @@ int ActiveThreads = 1;
 // but it could turn out to be useful for debugging.
 Lock IOLock;
 
-History H;  // Should be made local?
-
-// The empty search stack
-SearchStack EmptySearchStack;
-
 
 // SearchStack::init() initializes a search stack. Used at the beginning of a
 // new search from the root.
@@ -597,10 +595,6 @@ void init_threads() {
       // Wait until the thread has finished launching:
       while (!Threads[i].running);
   }
-
-  // Init also the empty search stack
-  EmptySearchStack.init(0);
-  EmptySearchStack.initKillers();
 }
 
 
@@ -1063,7 +1057,7 @@ namespace {
 
     // Initialize a MovePicker object for the current position, and prepare
     // to search all moves
-    MovePicker mp = MovePicker(pos, true, ttMove, ss[ply], depth);
+    MovePicker mp = MovePicker(pos, true, ttMove, depth, H, &ss[ply]);
 
     Move move, movesSearched[256];
     int moveCount = 0;
@@ -1324,7 +1318,7 @@ namespace {
 
     // Initialize a MovePicker object for the current position, and prepare
     // to search all moves:
-    MovePicker mp = MovePicker(pos, false, ttMove, ss[ply], depth);
+    MovePicker mp = MovePicker(pos, false, ttMove, depth, H, &ss[ply]);
 
     Move move, movesSearched[256];
     int moveCount = 0;
@@ -1545,7 +1539,7 @@ namespace {
     // Initialize a MovePicker object for the current position, and prepare
     // to search the moves.  Because the depth is <= 0 here, only captures,
     // queen promotions and checks (only if depth == 0) will be generated.
-    MovePicker mp = MovePicker(pos, pvNode, ttMove, EmptySearchStack, depth);
+    MovePicker mp = MovePicker(pos, pvNode, ttMove, depth, H);
     Move move;
     int moveCount = 0;
     Bitboard dcCandidates = mp.discovered_check_candidates();