From 040dfedb3457ca6971d98c754362cde4dc767aff Mon Sep 17 00:00:00 2001 From: =?utf8?q?Ste=CC=81phane=20Nicolet?= Date: Sun, 1 Oct 2023 20:19:49 +0200 Subject: [PATCH] Remove one test in the move loop Simplification passed STC test: https://tests.stockfishchess.org/tests/view/6519fc91cff46e538ee014f6 LLR: 2.94 (-2.94,2.94) <-1.75,0.25> Total: 191264 W: 48550 L: 48501 D: 94213 Ptnml(0-2): 576, 21529, 51392, 21540, 595 closes #4815 Non functional change --- src/search.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index 97b70b8f..55084788 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -945,18 +945,17 @@ moves_loop: // When in check, search starts here if (move == excludedMove) continue; + // Check for legality + if (!pos.legal(move)) + continue; + // At root obey the "searchmoves" option and skip moves not listed in Root - // Move List. As a consequence, any illegal move is also skipped. In MultiPV - // mode we also skip PV moves that have been already searched and those - // of lower "TB rank" if we are in a TB root position. + // Move List. In MultiPV mode we also skip PV moves that have been already + // searched and those of lower "TB rank" if we are in a TB root position. if (rootNode && !std::count(thisThread->rootMoves.begin() + thisThread->pvIdx, thisThread->rootMoves.begin() + thisThread->pvLast, move)) continue; - // Check for legality - if (!rootNode && !pos.legal(move)) - continue; - ss->moveCount = ++moveCount; if (rootNode && thisThread == Threads.main() && Time.elapsed() > 3000) -- 2.39.2