Skip to content

Commit 2e1369d

Browse files
AndyGrantvondele
authored andcommitted
Fix TT write in MultiPV case.
fixes an error reported earlier as #2404 by @AndyGrant. MultiPV at root shouldn't write to the TT for later lines, as that is neither the eval nor the bestmove for that position. Fixing this error doesn't matter for playing games (http://tests.stockfishchess.org/tests/view/5dcdbd810ebc590256324a11). However, it can lead to wrong mate announcements as reported by @uriblass. In particular the following testcase gives wrong results for the second search, prior to this patch: ``` setoption name MultiPV value 2 position fen 5R2/2kB2p1/p2bR3/8/3p1B2/8/PPP5/2K5 b - - 0 49 go depth 40 position fen 2B2R2/3r2p1/p1kbR3/8/3p1B2/8/PPP5/2K5 b - - 8 48 go depth 40 ``` fixes #2561 closes #2562 Only affects MultiPV search. Bench: 4697493
1 parent 8352977 commit 2e1369d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/search.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1339,7 +1339,7 @@ namespace {
13391339
if (PvNode)
13401340
bestValue = std::min(bestValue, maxValue);
13411341

1342-
if (!excludedMove)
1342+
if (!excludedMove && !(rootNode && thisThread->pvIdx))
13431343
tte->save(posKey, value_to_tt(bestValue, ss->ply), ttPv,
13441344
bestValue >= beta ? BOUND_LOWER :
13451345
PvNode && bestMove ? BOUND_EXACT : BOUND_UPPER,

0 commit comments

Comments
 (0)