1
0
Fork 0
mirror of https://github.com/sockspls/badfish synced 2025-06-27 16:09:52 +00:00

Correctly output lowerbound/upperbound scores

fixes the lowerbound/upperbound output by avoiding
scores outside the alpha,beta bracket. Since SF search
uses fail-soft we can't simply take the returned value
as score.

closes https://github.com/official-stockfish/Stockfish/pull/4259

No functional change
This commit is contained in:
Guenther Demetz 2022-12-06 19:09:33 +01:00 committed by Joost VandeVondele
parent 98965c139d
commit cb0c7a9848
2 changed files with 11 additions and 4 deletions

View file

@ -1245,10 +1245,16 @@ moves_loop: // When in check, search starts here
// PV move or new best move?
if (moveCount == 1 || value > alpha)
{
rm.score = value;
rm.score = rm.uciScore = value;
rm.selDepth = thisThread->selDepth;
rm.scoreLowerbound = value >= beta;
rm.scoreUpperbound = value <= alpha;
if (value >= beta) {
rm.scoreLowerbound = true;
rm.uciScore = beta;
}
else if (value <= alpha) {
rm.scoreUpperbound = true;
rm.uciScore = alpha;
}
rm.pv.resize(1);
assert((ss+1)->pv);
@ -1841,7 +1847,7 @@ string UCI::pv(const Position& pos, Depth depth) {
continue;
Depth d = updated ? depth : std::max(1, depth - 1);
Value v = updated ? rootMoves[i].score : rootMoves[i].previousScore;
Value v = updated ? rootMoves[i].uciScore : rootMoves[i].previousScore;
if (v == -VALUE_INFINITE)
v = VALUE_ZERO;

View file

@ -71,6 +71,7 @@ struct RootMove {
Value score = -VALUE_INFINITE;
Value previousScore = -VALUE_INFINITE;
Value averageScore = -VALUE_INFINITE;
Value uciScore = -VALUE_INFINITE;
bool scoreLowerbound = false;
bool scoreUpperbound = false;
int selDepth = 0;