]> git.sesse.net Git - stockfish/blobdiff - src/uci.cpp
Retire square_from_string()
[stockfish] / src / uci.cpp
index c9ecbf234fc16f993582e30bf1a9e62aac3ab1d8..5a42cd9758bce299d6aa1bcef9a349ed48f1ab4e 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")
-    {
-        set_option_value("New Game", "true");
         pos.from_fen(StartPositionFEN);
-    }
     else if (token == "isready")
         cout << "readyok" << endl;
     else if (token == "position")
@@ -199,7 +194,7 @@ namespace {
             StateInfo st;
             while (uip >> token)
             {
-                move = move_from_string(pos, token);
+                move = move_from_uci(pos, token);
                 pos.do_move(move, st);
                 if (pos.rule_50_counter() == 0)
                     pos.reset_game_ply();
@@ -233,16 +228,22 @@ namespace {
     while (uip >> token && token != "value")
         name += (" " + token);
 
+    if (Options.find(name) == Options.end())
+    {
+        cout << "No such option: " << name << endl;
+        return;
+    }
+
     if (token != "value" || !(uip >> value))
     {
-        set_option_value(name, "true");
+        Options[name].set_value("true");
         return;
     }
 
     while (uip >> token)
         value += (" " + token);
 
-    set_option_value(name, value);
+    Options[name].set_value(value);
   }
 
 
@@ -292,7 +293,7 @@ namespace {
         {
             int numOfMoves = 0;
             while (uip >> token)
-                searchMoves[numOfMoves++] = move_from_string(pos, token);
+                searchMoves[numOfMoves++] = move_from_uci(pos, token);
 
             searchMoves[numOfMoves] = MOVE_NONE;
         }