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)