void set_option(UCIInputParser& uip);
void set_position(UCIInputParser& uip);
bool go(UCIInputParser& uip);
+ void perft(UCIInputParser& uip);
}
cout << "key: " << hex << RootPosition.get_key()
<< "\nmaterial key: " << RootPosition.get_material_key()
<< "\npawn key: " << RootPosition.get_pawn_key() << endl;
+ else if (token == "perft")
+ perft(uip);
else
{
cout << "Unknown command: " << command << endl;
}
if (token == "value")
{
- getline(uip, token); // reads until end of line
+ // Reads until end of line and left trim white space
+ getline(uip, token);
+ token.erase(0, token.find_first_not_of(" \n\r\t"));
+
set_option_value(name, token);
} else
push_button(name);
time, inc, movesToGo, depth, nodes, moveTime, searchMoves);
}
+ void perft(UCIInputParser& uip) {
+
+ string token;
+ int depth = 0;
+
+ while (!uip.eof())
+ {
+ uip >> token;
+
+ 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
+ << "\nNodes/second " << (int)(n/(tm/1000.0)) << std::endl;
+ }
}