5 #include <grpc++/grpc++.h>
7 #include "hashprobe.grpc.pb.h"
12 using grpc::ClientContext;
15 int main(int argc, char** argv) {
16 std::shared_ptr<Channel> channel(grpc::CreateChannel(
17 "localhost:50051", grpc::InsecureChannelCredentials()));
18 std::unique_ptr<HashProbe::Stub> stub(HashProbe::NewStub(channel));
22 if (fgets(buf, sizeof(buf), stdin) == nullptr || buf[0] == '\n') {
26 char *ptr = strchr(buf, '\n');
27 if (ptr != nullptr) *ptr = 0;
29 HashProbeRequest request;
32 HashProbeResponse response;
33 ClientContext context;
34 Status status = stub->Probe(&context, request, &response);
37 std::cout << response.found() << " ";
38 if (Move(response.move()) == MOVE_NULL) {
39 std::cout << "Null-move ";
40 } else if (Move(response.move()) == MOVE_NONE) {
41 std::cout << "MOVE_NONE ";
43 std::cout << UCI::square(from_sq(Move(response.move())))
44 << UCI::square(to_sq(Move(response.move()))) << " ";
46 switch (response.bound()) {
47 case HashProbeResponse::BOUND_NONE:
50 case HashProbeResponse::BOUND_EXACT:
53 case HashProbeResponse::BOUND_UPPER:
56 case HashProbeResponse::BOUND_LOWER:
60 std::cout << " " << UCI::value(Value(response.value())) << " ";
61 std::cout << response.depth() << std::endl;
63 std::cout << "ERROR" << std::endl;