1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-04-29 16:23:09 +00:00

Fix score_to_uci()

The condition for a mate score was wrong:

abs(v) < VALUE_MATE - PLY_MAX * ONE_PLY

instead of

abs(v) < VALUE_MATE_IN_PLY_MAX

No functional change.

Signed-off-by: Marco Costalba <mcostalba@gmail.com>
This commit is contained in:
Marco Costalba 2011-12-28 14:18:56 +01:00
parent 24417a6cd9
commit ae65ab25d5

View file

@ -410,10 +410,10 @@ namespace {
bestValue = delta = -VALUE_INFINITE;
ss->currentMove = MOVE_NULL; // Hack to skip update gains
// Handle the special case of a mate/stalemate position
// Handle the special case of a mated/stalemate position
if (RootMoves.empty())
{
cout << "info depth 0"
cout << "info depth 0 score "
<< score_to_uci(pos.in_check() ? -VALUE_MATE : VALUE_DRAW) << endl;
RootMoves.push_back(MOVE_NONE);
@ -1624,10 +1624,10 @@ split_point_start: // At split points actual search starts from here
std::stringstream s;
if (abs(v) < VALUE_MATE - PLY_MAX * ONE_PLY)
s << " score cp " << int(v) * 100 / int(PawnValueMidgame); // Scale to centipawns
if (abs(v) < VALUE_MATE_IN_PLY_MAX)
s << "cp " << v * 100 / int(PawnValueMidgame);
else
s << " score mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2;
s << "mate " << (v > 0 ? VALUE_MATE - v + 1 : -VALUE_MATE - v) / 2;
s << (v >= beta ? " lowerbound" : v <= alpha ? " upperbound" : "");
@ -1664,7 +1664,7 @@ split_point_start: // At split points actual search starts from here
cout << "info depth " << d
<< " seldepth " << selDepth
<< (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
<< " score " << (i == PVIdx ? score_to_uci(v, alpha, beta) : score_to_uci(v))
<< " nodes " << pos.nodes_searched()
<< " nps " << (t > 0 ? pos.nodes_searched() * 1000 / t : 0)
<< " time " << t