mirror of
https://github.com/HChaZZY/Stockfish.git
synced 2025-12-21 17:46:26 +08:00
Save stalemates in TT
When there aren't legal moves after
a search, instead of returning imediately,
save bestValue in TT as in the usual case.
There is really no reason to special case
this one.
With this patch is fully fixed (again) follwing
position:
7k/6p1/6B1/5K1P/8/8/8/8 w - - 0 1
Also in SMP case.
bench: 8802105
This commit is contained in:
@@ -1017,18 +1017,18 @@ moves_loop: // When in check and at SpNode search starts from here
|
||||
// must be mate or stalemate. If we are in a singular extension search then
|
||||
// return a fail low score.
|
||||
if (!moveCount)
|
||||
return excludedMove ? alpha
|
||||
bestValue = excludedMove ? alpha
|
||||
: inCheck ? mated_in(ss->ply) : DrawValue[pos.side_to_move()];
|
||||
|
||||
// Quiet best move: update killers, history, countermoves and followupmoves
|
||||
else if (bestValue >= beta && !pos.capture_or_promotion(bestMove) && !inCheck)
|
||||
update_stats(pos, ss, bestMove, depth, quietsSearched, quietCount - 1);
|
||||
|
||||
TT.store(posKey, value_to_tt(bestValue, ss->ply),
|
||||
bestValue >= beta ? BOUND_LOWER :
|
||||
PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER,
|
||||
depth, bestMove, ss->staticEval);
|
||||
|
||||
// Quiet best move: update killers, history, countermoves and followupmoves
|
||||
if (bestValue >= beta && !pos.capture_or_promotion(bestMove) && !inCheck)
|
||||
update_stats(pos, ss, bestMove, depth, quietsSearched, quietCount - 1);
|
||||
|
||||
assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE);
|
||||
|
||||
return bestValue;
|
||||
|
||||
Reference in New Issue
Block a user