]> git.sesse.net Git - stockfish/blobdiff - src/uci.cpp
Include <cstring> in search.h
[stockfish] / src / uci.cpp
index 72e3d0bd0cd4600f5c1694c884ff769b1a1d6a66..306819bb3e46f680544f4a0b0fea69a9f6921782 100644 (file)
@@ -205,18 +205,16 @@ namespace {
   void go(Position& pos, istringstream& is) {
 
     string token;
+    Search::LimitsType limits;
+    std::vector<Move> searchMoves;
     int time[] = { 0, 0 }, inc[] = { 0, 0 };
 
-    memset(&Search::Limits, 0, sizeof(Search::Limits));
-    Search::RootMoves.clear();
-    Search::RootPosition = &pos;
-
     while (is >> token)
     {
         if (token == "infinite")
-            Search::Limits.infinite = true;
+            limits.infinite = true;
         else if (token == "ponder")
-            Search::Limits.ponder = true;
+            limits.ponder = true;
         else if (token == "wtime")
             is >> time[WHITE];
         else if (token == "btime")
@@ -226,23 +224,22 @@ namespace {
         else if (token == "binc")
             is >> inc[BLACK];
         else if (token == "movestogo")
-            is >> Search::Limits.movesToGo;
+            is >> limits.movesToGo;
         else if (token == "depth")
-            is >> Search::Limits.maxDepth;
+            is >> limits.maxDepth;
         else if (token == "nodes")
-            is >> Search::Limits.maxNodes;
+            is >> limits.maxNodes;
         else if (token == "movetime")
-            is >> Search::Limits.maxTime;
+            is >> limits.maxTime;
         else if (token == "searchmoves")
             while (is >> token)
-                Search::RootMoves.push_back(move_from_uci(pos, token));
+                searchMoves.push_back(move_from_uci(pos, token));
     }
+    searchMoves.push_back(MOVE_NONE);
+    limits.time = time[pos.side_to_move()];
+    limits.increment = inc[pos.side_to_move()];
 
-    Search::RootMoves.push_back(MOVE_NONE);
-    Search::Limits.time = time[pos.side_to_move()];
-    Search::Limits.increment = inc[pos.side_to_move()];
-
-    Threads.start_thinking();
+    Threads.start_thinking(pos, limits, searchMoves, true);
   }