]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Extend castling independently of singular extension
[stockfish] / src / search.cpp
index 2d5fb6305b8d84dde21795edd409d2af2d88285c..01de12a4cea99b662ce0134349be1b3c3dadaeb5 100644 (file)
@@ -997,10 +997,6 @@ moves_loop: // When in check, search starts from here
                && (pos.is_discovery_check_on_king(~us, move) || pos.see_ge(move)))
           extension = ONE_PLY;
 
-      // Castling extension
-      else if (type_of(move) == CASTLING)
-          extension = ONE_PLY;
-
       // Shuffle extension
       else if (   PvNode
                && pos.rule50_count() > 18
@@ -1013,6 +1009,10 @@ moves_loop: // When in check, search starts from here
                && pos.advanced_pawn_push(move)
                && pos.pawn_passed(us, to_sq(move)))
           extension = ONE_PLY;
+          
+      // Castling extension
+      if (type_of(move) == CASTLING)
+          extension = ONE_PLY;
 
       // Calculate new depth for this move
       newDepth = depth - ONE_PLY + extension;