std::cout << ">=";
break;
}
- std::cout << " " << UCI::value(Value(line.value())) << " ";
+ switch (line.value().score_type()) {
+ case HashProbeScore::SCORE_CP:
+ std::cout << " cp " << line.value().score_cp() << " ";
+ break;
+ case HashProbeScore::SCORE_MATE:
+ std::cout << " mate " << line.value().score_mate() << " ";
+ break;
+ }
std::cout << line.depth() << std::endl;
}
std::cout << "END" << std::endl;
bool found = 2;
repeated HashProbeMove pv = 3;
- int32 value = 4; // Dynamic eval (may be inexact, see the "bound" field)
- int32 eval = 5; // Static eval
+ HashProbeScore value = 4; // Dynamic eval (may be inexact, see the "bound" field)
+ HashProbeScore eval = 5; // Static eval
int32 depth = 6;
enum ValueBound {
string to_sq = 2;
string promotion = 3; // Q, R, etc.
}
+message HashProbeScore {
+ enum ScoreType {
+ SCORE_CP = 0;
+ SCORE_MATE = 1;
+ }
+ ScoreType score_type = 1;
+ int32 score_cp = 2;
+ int32 score_mate = 3;
+}
service HashProbe {
rpc Probe(HashProbeRequest) returns (HashProbeResponse) {}
}
response->set_depth(entry->depth());
- response->set_eval(eval);
- response->set_value(value);
+ FillValue(eval, response->mutable_eval());
+ FillValue(value, response->mutable_value());
response->set_bound(HashProbeLine::ValueBound(bound));
// Follow the PV until we hit an illegal move.
}
}
}
+
+ void FillValue(Value value, HashProbeScore* score) {
+ if (abs(value) < VALUE_MATE - MAX_PLY) {
+ score->set_score_type(HashProbeScore::SCORE_CP);
+ score->set_score_cp(value * 100 / PawnValueEg);
+ } else {
+ score->set_score_type(HashProbeScore::SCORE_MATE);
+ score->set_score_mate((value > 0 ? VALUE_MATE - value + 1 : -VALUE_MATE - value) / 2);
+ }
+ }
};
void rpc_thread()