]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Simplify lowply-history scoring logic
[stockfish] / src / search.cpp
index fef1b518160abf00e7e6e4ac14a7e656d2ed4046..66402f0429a390d491aeaae86b26021e5f5de185 100644 (file)
@@ -1472,6 +1472,10 @@ moves_loop: // When in check, search starts from here
     {
       assert(is_ok(move));
 
+      // Check for legality
+      if (!pos.legal(move))
+          continue;
+
       givesCheck = pos.gives_check(move);
       captureOrPromotion = pos.capture_or_promotion(move);
 
@@ -1510,13 +1514,6 @@ moves_loop: // When in check, search starts from here
       // Speculative prefetch as early as possible
       prefetch(TT.first_entry(pos.key_after(move)));
 
-      // Check for legality just before making the move
-      if (!pos.legal(move))
-      {
-          moveCount--;
-          continue;
-      }
-
       ss->currentMove = move;
       ss->continuationHistory = &thisThread->continuationHistory[ss->inCheck]
                                                                 [captureOrPromotion]