// Read UCI option values
TT.set_size(get_option_value_int("Hash"));
- if (button_was_pressed("Clear Hash"))
+ if (get_option_value_bool("Clear Hash"))
+ {
+ set_option_value("Clear Hash", "false");
TT.clear();
+ }
CheckExtension[1] = Depth(get_option_value_int("Check Extension (PV nodes)"));
CheckExtension[0] = Depth(get_option_value_int("Check Extension (non-PV nodes)"));
}
else if (token == "ucinewgame")
{
- push_button("New Game");
+ set_option_value("New Game", "true");
pos.from_fen(StartPositionFEN);
}
else if (token == "isready")
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 (token != "value" || !(uip >> value))
+ {
+ set_option_value(name, "true");
+ return;
}
+
+ while (uip >> token)
+ value += (" " + token);
+
+ set_option_value(name, value);
}
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;
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;
}
}
if (opt.type == CHECK && v != "0" && v != "1")
return;
- else if (opt.type == SPIN)
+ if (opt.type == SPIN)
{
int val = atoi(v.c_str());
if (val < opt.minValue || val > opt.maxValue)
}
opt.currentValue = v;
}
-
-
-/// push_button() is used to tell the engine that a UCI parameter of type
-/// "button" has been selected:
-
-void push_button(const string& buttonName) {
-
- set_option_value(buttonName, "true");
-}
-
-
-/// button_was_pressed() tests whether a UCI parameter of type "button" has
-/// been selected since the last time the function was called, in this case
-/// it also resets the button.
-
-bool button_was_pressed(const string& buttonName) {
-
- if (!get_option_value<bool>(buttonName))
- return false;
-
- set_option_value(buttonName, "false");
- return true;
-}
extern bool get_option_value_bool(const std::string& optionName);
extern int get_option_value_int(const std::string& optionName);
extern std::string get_option_value_string(const std::string& optionName);
-extern bool button_was_pressed(const std::string& buttonName);
extern void set_option_value(const std::string& optionName,const std::string& newValue);
-extern void push_button(const std::string& buttonName);
-
#endif // !defined(UCIOPTION_H_INCLUDED)