]> git.sesse.net Git - stockfish/blobdiff - src/uci.cpp
Retire history[]
[stockfish] / src / uci.cpp
index e6f01d3c72670a24da0f7ed22c5c48651d264fec..fb24bb264c9235cc0f4742afcf52763906ac71f3 100644 (file)
@@ -21,6 +21,7 @@
 #include <iostream>
 #include <sstream>
 #include <string>
+#include <vector>
 
 #include "evaluate.h"
 #include "misc.h"
@@ -36,6 +37,10 @@ namespace {
   // FEN string for the initial position
   const string StartPositionFEN = "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1";
 
+  // Keep track of position keys along the setup moves (from start position to the
+  // position just before to start searching). This is needed by draw detection.
+  std::vector<StateInfo> SetupState;
+
   // UCIParser is a class for parsing UCI input. The class
   // is actually a string stream built on a given input string.
   typedef istringstream UCIParser;
@@ -140,8 +145,13 @@ namespace {
     else return;
 
     // Parse move list (if any)
+    SetupState.clear();
+
     while (up >> token && (m = move_from_uci(pos, token)) != MOVE_NONE)
-        pos.do_setup_move(m);
+    {
+        SetupState.push_back(StateInfo());
+        pos.do_setup_move(m, SetupState.back());
+    }
   }