mirror of
https://github.com/sockspls/badfish
synced 2025-04-30 08:43:09 +00:00
Better document value_to_uci()
No functional change. Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
parent
afe0203f98
commit
6f2e4c006c
1 changed files with 7 additions and 2 deletions
|
@ -1948,14 +1948,19 @@ split_point_start: // At split points actual search starts from here
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// value_to_uci() converts a value to a string suitable for use with the UCI protocol
|
// value_to_uci() converts a value to a string suitable for use with the UCI
|
||||||
|
// protocol specifications:
|
||||||
|
//
|
||||||
|
// cp <x> The score from the engine's point of view in centipawns.
|
||||||
|
// mate <y> Mate in y moves, not plies. If the engine is getting mated
|
||||||
|
// use negative values for y.
|
||||||
|
|
||||||
std::string value_to_uci(Value v) {
|
std::string value_to_uci(Value v) {
|
||||||
|
|
||||||
std::stringstream s;
|
std::stringstream s;
|
||||||
|
|
||||||
if (abs(v) < VALUE_MATE - PLY_MAX * ONE_PLY)
|
if (abs(v) < VALUE_MATE - PLY_MAX * ONE_PLY)
|
||||||
s << "cp " << int(v) * 100 / int(PawnValueMidgame); // Scale to pawn = 100
|
s << "cp " << int(v) * 100 / int(PawnValueMidgame); // Scale to centipawns
|
||||||
else
|
else
|
||||||
s << "mate " << (v > 0 ? (VALUE_MATE - v + 1) / 2 : -(VALUE_MATE + v) / 2 );
|
s << "mate " << (v > 0 ? (VALUE_MATE - v + 1) / 2 : -(VALUE_MATE + v) / 2 );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue