I use c++ sample code,
I need to get data from this code,
void UCI::command(const string& cmd) {
istringstream is(cmd);
string token;
is >> skipws >> token;
if (token == "quit" || token == "stop" || token == "ponderhit")
{
// The GUI sends 'ponderhit' to tell us to ponder on the same move the
// opponent has played. In case Signals.stopOnPonderhit is set we are
// waiting for 'ponderhit' to stop the search (for instance because we
// already ran out of time), otherwise we should continue searching but
// switch from pondering to normal search.
if (token != "ponderhit" || Search::Signals.stopOnPonderhit)
{
Search::Signals.stop = true;
Threads.main()->notify_one(); // Could be sleeping
}
else
Search::Limits.ponder = false;
}
else if (token == "perft" || token == "divide")
{
int depth;
stringstream ss;
is >> depth;
ss << Options["Hash"] << " "
<< Options["Threads"] << " " << depth << " current " << token;
benchmark(currentPos, ss);
}
else if (token == "key")
sync_cout << hex << uppercase << setfill('0')
<< "position key: " << setw(16) << currentPos.key()
<< "\nmaterial key: " << setw(16) << currentPos.material_key()
<< "\npawn key: " << setw(16) << currentPos.pawn_key()
<< dec << nouppercase << setfill(' ') << sync_endl;
else if (token == "uci")
sync_cout << "id name " << engine_info(true)
<< "\n" << Options
<< "\nuciok" << sync_endl;
else if (token == "eval")
{
Search::RootColor = currentPos.side_to_move(); // Ensure it is set
sync_cout << Eval::trace(currentPos) << sync_endl;
}
else if (token == "ucinewgame") TT.clear();
else if (token == "go") go(currentPos, is);
else if (token == "position") position(currentPos, is);
else if (token == "setoption") setoption(is);
else if (token == "flip") currentPos.flip();
else if (token == "bench") benchmark(currentPos, is);
else if (token == "d") sync_cout << currentPos.pretty() << sync_endl;
else if (token == "isready") sync_cout << "readyok" << sync_endl;
else
sync_cout << "Unknown command: " << cmd << sync_endl;
}