X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fclient.cpp;h=b1eead58d5d5d9dc54bfb3bb8a55642b20c89c2e;hp=5bb480fa8d212428cae94c1f6ed648f4c4eee147;hb=4c1a8ff9da057987e34936af8743a4d179a472dc;hpb=3b22627a134c8f0d8c4ac882a1a89562d47a0e01 diff --git a/src/client.cpp b/src/client.cpp index 5bb480fa..b1eead58 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -12,6 +12,16 @@ using grpc::Channel; using grpc::ClientContext; using grpc::Status; +std::string FormatMove(Move move) { + if (move == MOVE_NULL) { + return "Null-move"; + } else if (move == MOVE_NONE) { + return "MOVE_NONE"; + } else { + return UCI::square(from_sq(move)) + UCI::square(to_sq(move)); + } +} + int main(int argc, char** argv) { std::shared_ptr channel(grpc::CreateChannel( "localhost:50051", grpc::InsecureChannelCredentials())); @@ -34,25 +44,28 @@ int main(int argc, char** argv) { Status status = stub->Probe(&context, request, &response); if (status.ok()) { - std::cout << response.found() << " " - << UCI::square(from_sq(Move(response.move()))) - << UCI::square(to_sq(Move(response.move()))) << " "; - switch (response.bound()) { - case HashProbeResponse::BOUND_NONE: - std::cout << "?"; - break; - case HashProbeResponse::BOUND_EXACT: - std::cout << "=="; - break; - case HashProbeResponse::BOUND_UPPER: - std::cout << "<="; - break; - case HashProbeResponse::BOUND_LOWER: - std::cout << ">="; - break; - } - std::cout << " " << UCI::value(Value(response.value())) << " "; - std::cout << response.depth() << std::endl; + for (const HashProbeMove &hpmove : response.move()) { + std::cout << FormatMove(Move(hpmove.move())) << " "; + std::cout << hpmove.found() << " "; + std::cout << FormatMove(Move(hpmove.pv_move())) << " "; + switch (hpmove.bound()) { + case HashProbeMove::BOUND_NONE: + std::cout << "?"; + break; + case HashProbeMove::BOUND_EXACT: + std::cout << "=="; + break; + case HashProbeMove::BOUND_UPPER: + std::cout << "<="; + break; + case HashProbeMove::BOUND_LOWER: + std::cout << ">="; + break; + } + std::cout << " " << UCI::value(Value(hpmove.value())) << " "; + std::cout << hpmove.depth() << std::endl; + } + std::cout << "END" << std::endl; } else { std::cout << "ERROR" << std::endl; }