1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-07-11 19:49:14 +00:00

Creative formatting in uci.cpp

Have some fun breaking the indentation rules :-)

No functional change.
This commit is contained in:
Marco Costalba 2012-10-28 11:09:47 +01:00
parent cee6336515
commit ad1941fd00

View file

@ -90,44 +90,7 @@ void UCI::loop(const string& args) {
} }
} }
else if (token == "go") else if (token == "perft" && (is >> token)) // Read requested depth
go(pos, is);
else if (token == "ucinewgame")
TT.clear();
else if (token == "isready")
sync_cout << "readyok" << sync_endl;
else if (token == "position")
set_position(pos, is);
else if (token == "setoption")
set_option(is);
else if (token == "d")
pos.print();
else if (token == "flip")
pos.flip();
else if (token == "eval")
sync_cout << Eval::trace(pos) << sync_endl;
else if (token == "bench")
benchmark(pos, is);
else if (token == "key")
sync_cout << "key: " << hex << pos.key()
<< "\nmaterial key: " << pos.material_key()
<< "\npawn key: " << pos.pawn_key() << sync_endl;
else if (token == "uci")
sync_cout << "id name " << engine_info(true)
<< "\n" << Options
<< "\nuciok" << sync_endl;
else if (token == "perft" && (is >> token)) // Read depth
{ {
stringstream ss; stringstream ss;
@ -137,6 +100,24 @@ void UCI::loop(const string& args) {
benchmark(pos, ss); benchmark(pos, ss);
} }
else if (token == "key") sync_cout << "position key: " << hex << pos.key()
<< "\nmaterial key: " << pos.material_key()
<< "\npawn key: " << pos.pawn_key()
<< sync_endl;
else if (token == "uci") sync_cout << "id name " << engine_info(true)
<< "\n" << Options
<< "\nuciok" << sync_endl;
else if (token == "ucinewgame") TT.clear();
else if (token == "go") go(pos, is);
else if (token == "position") set_position(pos, is);
else if (token == "setoption") set_option(is);
else if (token == "d") pos.print();
else if (token == "flip") pos.flip();
else if (token == "bench") benchmark(pos, is);
else if (token == "isready") sync_cout << "readyok" << sync_endl;
else if (token == "eval") sync_cout << Eval::trace(pos) << sync_endl;
else else
sync_cout << "Unknown command: " << cmd << sync_endl; sync_cout << "Unknown command: " << cmd << sync_endl;
@ -222,29 +203,20 @@ namespace {
while (is >> token) while (is >> token)
{ {
if (token == "wtime") if (token == "searchmoves")
is >> limits.time[WHITE];
else if (token == "btime")
is >> limits.time[BLACK];
else if (token == "winc")
is >> limits.inc[WHITE];
else if (token == "binc")
is >> limits.inc[BLACK];
else if (token == "movestogo")
is >> limits.movestogo;
else if (token == "depth")
is >> limits.depth;
else if (token == "nodes")
is >> limits.nodes;
else if (token == "movetime")
is >> limits.movetime;
else if (token == "infinite")
limits.infinite = true;
else if (token == "ponder")
limits.ponder = true;
else if (token == "searchmoves")
while (is >> token) while (is >> token)
searchMoves.push_back(move_from_uci(pos, token)); searchMoves.push_back(move_from_uci(pos, token));
else if (token == "wtime") is >> limits.time[WHITE];
else if (token == "btime") is >> limits.time[BLACK];
else if (token == "winc") is >> limits.inc[WHITE];
else if (token == "binc") is >> limits.inc[BLACK];
else if (token == "movestogo") is >> limits.movestogo;
else if (token == "depth") is >> limits.depth;
else if (token == "nodes") is >> limits.nodes;
else if (token == "movetime") is >> limits.movetime;
else if (token == "infinite") limits.infinite = true;
else if (token == "ponder") limits.ponder = true;
} }
Threads.start_searching(pos, limits, searchMoves, SetupStates); Threads.start_searching(pos, limits, searchMoves, SetupStates);