]> git.sesse.net Git - stockfish/commitdiff
Remove one test in the move loop
authorStéphane Nicolet <cassio@free.fr>
Sun, 1 Oct 2023 18:19:49 +0000 (20:19 +0200)
committerJoost VandeVondele <Joost.VandeVondele@gmail.com>
Sun, 8 Oct 2023 05:41:16 +0000 (07:41 +0200)
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

index 97b70b8fefd7ffcea1b96a21890ab0330522d66c..5508478862fe1a37f75cd09e9169db8e3836e0dc 100644 (file)
@@ -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)