Skip to content

Commit 27efc5a

Browse files
locutus2zamar
authored andcommitted
Update stats at pv nodes
If a quiet best move is found at a pv node then always update stats. STC: LLR: 2.96 (-2.94,2.94) [-1.50,4.50] Total: 41485 W: 8047 L: 7830 D: 25608 LTC: LLR: 2.96 (-2.94,2.94) [0.00,6.00] Total: 14351 W: 2420 L: 2250 D: 9681 Bench: 6985247 Resolves #330
1 parent 36f2133 commit 27efc5a

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/search.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -945,8 +945,6 @@ namespace {
945945
}
946946

947947
ss->currentMove = move;
948-
if (!SpNode && !captureOrPromotion && quietCount < 64)
949-
quietsSearched[quietCount++] = move;
950948

951949
// Step 14. Make the move
952950
pos.do_move(move, st, givesCheck);
@@ -1070,6 +1068,7 @@ namespace {
10701068
rm.score = -VALUE_INFINITE;
10711069
}
10721070

1071+
bool newBestMove = false;
10731072
if (value > bestValue)
10741073
{
10751074
bestValue = SpNode ? splitPoint->bestValue = value : value;
@@ -1082,6 +1081,7 @@ namespace {
10821081
&& (move != EasyMove.get(pos.key()) || moveCount > 1))
10831082
EasyMove.clear();
10841083

1084+
newBestMove = true;
10851085
bestMove = SpNode ? splitPoint->bestMove = move : move;
10861086

10871087
if (PvNode && !RootNode) // Update pv even in fail-high case
@@ -1101,6 +1101,9 @@ namespace {
11011101
}
11021102
}
11031103

1104+
if (!SpNode && !captureOrPromotion && !newBestMove && quietCount < 64)
1105+
quietsSearched[quietCount++] = move;
1106+
11041107
// Step 19. Check for splitting the search
11051108
if ( !SpNode
11061109
&& Threads.size() >= 2
@@ -1144,8 +1147,8 @@ namespace {
11441147
: inCheck ? mated_in(ss->ply) : DrawValue[pos.side_to_move()];
11451148

11461149
// Quiet best move: update killers, history and countermoves
1147-
else if (bestValue >= beta && !pos.capture_or_promotion(bestMove))
1148-
update_stats(pos, ss, bestMove, depth, quietsSearched, quietCount - 1);
1150+
else if (bestMove != MOVE_NONE && !pos.capture_or_promotion(bestMove))
1151+
update_stats(pos, ss, bestMove, depth, quietsSearched, quietCount);
11491152

11501153
tte->save(posKey, value_to_tt(bestValue, ss->ply),
11511154
bestValue >= beta ? BOUND_LOWER :
@@ -1402,8 +1405,7 @@ namespace {
14021405
*pv = MOVE_NONE;
14031406
}
14041407

1405-
// update_stats() updates killers, history and countermoves stats after a fail-high
1406-
// of a quiet move.
1408+
// update_stats() updates killers, history, countermove history and countermoves stats for a quiet best move.
14071409

14081410
void update_stats(const Position& pos, Stack* ss, Move move, Depth depth, Move* quiets, int quietsCnt) {
14091411

0 commit comments

Comments
 (0)