]> git.sesse.net Git - stockfish/blobdiff - src/uci.cpp
Retire piece.cpp
[stockfish] / src / uci.cpp
index e59df6dd737f79b9f66eb832b6ef6eeaa68a35a6..a4a73fbf3eea557e05d1e4da9c86288a325c29fc 100644 (file)
@@ -27,7 +27,6 @@
 #include <sstream>
 #include <string>
 
-#include "book.h"
 #include "evaluate.h"
 #include "misc.h"
 #include "move.h"
@@ -35,7 +34,6 @@
 #include "position.h"
 #include "san.h"
 #include "search.h"
-#include "uci.h"
 #include "ucioption.h"
 
 using namespace std;
@@ -121,10 +119,7 @@ namespace {
         cout << "uciok" << endl;
     }
     else if (token == "ucinewgame")
-    {
-        push_button("New Game");
         pos.from_fen(StartPositionFEN);
-    }
     else if (token == "isready")
         cout << "readyok" << endl;
     else if (token == "position")
@@ -227,20 +222,28 @@ namespace {
     if (!(uip >> token)) // operator>>() skips any whitespace
         return;
 
-    if (token == "name" && uip >> name)
-    {
-        while (uip >> token && token != "value")
-            name += (" " + token);
+    if (token != "name" || !(uip >> name))
+        return;
 
-        if (token == "value" && uip >> value)
-        {
-            while (uip >> token)
-                value += (" " + token);
+    while (uip >> token && token != "value")
+        name += (" " + token);
 
-            set_option_value(name, value);
-        } else
-            push_button(name);
+    if (Options.find(name) == Options.end())
+    {
+        cout << "No such option: " << name << endl;
+        return;
     }
+
+    if (token != "value" || !(uip >> value))
+    {
+        Options[name].set_value("true");
+        return;
+    }
+
+    while (uip >> token)
+        value += (" " + token);
+
+    Options[name].set_value(value);
   }
 
 
@@ -260,7 +263,7 @@ namespace {
     int time[2] = {0, 0}, inc[2] = {0, 0};
     int movesToGo = 0, depth = 0, nodes = 0, moveTime = 0;
     bool infinite = false, ponder = false;
-    Move searchMoves[500];
+    Move searchMoves[MOVES_MAX];
 
     searchMoves[0] = MOVE_NONE;
 
@@ -317,6 +320,6 @@ namespace {
     tm = get_system_time() - tm;
     std::cout << "\nNodes " << n
               << "\nTime (ms) " << tm
-              << "\nNodes/second " << (int)(n/(tm/1000.0)) << std::endl;
+              << "\nNodes/second " << int(n / (tm / 1000.0)) << std::endl;
   }
 }