- HashProbeRequest request;
-// request.set_fen("rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1");
- request.set_fen(argv[1]);
-
- HashProbeResponse response;
- ClientContext context;
- Status status = stub->Probe(&context, request, &response);
-
- if (status.ok()) {
- std::cout << response.DebugString();
- } else {
- std::cout << "RPC failed";
+ for ( ;; ) {
+ char buf[256];
+ if (fgets(buf, sizeof(buf), stdin) == nullptr || buf[0] == '\n') {
+ exit(0);
+ }
+
+ char *ptr = strchr(buf, '\n');
+ if (ptr != nullptr) *ptr = 0;
+
+ HashProbeRequest request;
+ request.set_fen(buf);
+
+ HashProbeResponse response;
+ ClientContext context;
+ 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:
+ case HashProbeResponse::BOUND_EXACT:
+ 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;
+ } else {
+ std::cout << "ERROR" << std::endl;
+ }