]> git.sesse.net Git - stockfish/blobdiff - src/uci.cpp
Use a more standard perft UCI interface
[stockfish] / src / uci.cpp
index f6b27114b13d64f60fafbd24c74c9550b7053afe..69de2fb1fe4daa5bf43bbd1dc4136c05c6ebda22 100644 (file)
@@ -324,18 +324,17 @@ namespace {
   void perft(UCIInputParser& uip) {
 
     string token;
-    int depth = 0;
+    int depth, tm, n;
+    Position pos = RootPosition;
 
-    while (!uip.eof())
-    {
-        uip >> token;
+    if (uip.eof())
+        return;
+
+    uip >> depth;
+    tm = get_system_time();
+
+    n = perft(pos, depth * OnePly);
 
-        if (token == "depth")
-            uip >> depth;
-    }
-    Position pos = RootPosition;
-    int tm = get_system_time();
-    int n = perft(pos, depth * OnePly);
     tm = get_system_time() - tm;
     std::cout << "\nNodes " << n
               << "\nTime (ms) " << tm