Skip to content

Commit f368081

Browse files
joergostermstembera
authored andcommitted
Improve multiPV mode
Skip all moves during the Non-PV (zero-window) search which will be searched as PV moves later anyways. We also wake sure the moves will be reported to the GUI despite they're not being searched — some GUIs may get confused otherwise, and it would unnecessarily complicate the code. Tested with MultiPV=4 STC http://tests.stockfishchess.org/tests/view/5ce7137c0ebc5925cf070d69 LLR: 2.95 (-2.94,2.94) [0.50,4.50] Total: 8233 W: 3708 L: 3424 D: 1101 LTC http://tests.stockfishchess.org/tests/view/5ce798d60ebc5925cf071d17 LLR: 2.95 (-2.94,2.94) [0.00,3.50] Total: 7369 W: 3197 L: 2911 D: 1261 Closes official-stockfish#2163 No functional change. (in single PV mode)
1 parent c2423a8 commit f368081

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/search.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,7 @@ void Thread::search() {
292292
bestValue = delta = alpha = -VALUE_INFINITE;
293293
beta = VALUE_INFINITE;
294294

295-
size_t multiPV = Options["MultiPV"];
295+
multiPV = Options["MultiPV"];
296296
Skill skill(Options["Skill Level"]);
297297

298298
// When playing with strength handicap enable MultiPV search that we will
@@ -870,6 +870,12 @@ namespace {
870870
sync_cout << "info depth " << depth / ONE_PLY
871871
<< " currmove " << UCI::move(move, pos.is_chess960())
872872
<< " currmovenumber " << moveCount + thisThread->pvIdx << sync_endl;
873+
874+
// In MultiPV mode also skip moves which will be searched later as PV moves
875+
if (rootNode && std::count(thisThread->rootMoves.begin() + thisThread->pvIdx + 1,
876+
thisThread->rootMoves.begin() + thisThread->multiPV, move))
877+
continue;
878+
873879
if (PvNode)
874880
(ss+1)->pv = nullptr;
875881

src/thread.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class Thread {
5959

6060
Pawns::Table pawnsTable;
6161
Material::Table materialTable;
62-
size_t pvIdx, pvLast, shuffleExts;
62+
size_t pvIdx, multiPV, pvLast, shuffleExts;
6363
int selDepth, nmpMinPly;
6464
Color nmpColor;
6565
std::atomic<uint64_t> nodes, tbHits, bestMoveChanges;

0 commit comments

Comments
 (0)