]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Revert "Last minute surprise" for now
[stockfish] / src / search.cpp
index d19c9a9015423192991319e4e6b910db955c4e8e..80eeb717f52d548897a5fdf4b7d9119d908aaefd 100644 (file)
@@ -931,7 +931,6 @@ namespace {
     {
       assert(move_is_ok(move));
 
-      bool fewMoves = (depth <= OnePly && mp.number_of_moves() < 4);
       bool singleReply = (pos.is_check() && mp.number_of_moves() == 1);
       bool moveIsCheck = pos.move_is_check(move, dcCandidates);
       bool moveIsCapture = pos.move_is_capture(move);
@@ -943,7 +942,7 @@ namespace {
         PawnValueMidgame : pos.midgame_value_of_piece_on(move_to(move));
 
       // Decide the new search depth
-      Depth ext = extension(pos, move, true, moveIsCheck, singleReply || fewMoves, mateThreat);
+      Depth ext = extension(pos, move, true, moveIsCheck, singleReply, mateThreat);
       Depth newDepth = depth - OnePly + ext;
 
       // Make and search the move
@@ -1997,26 +1996,35 @@ namespace {
 
   Depth extension(const Position &pos, Move m, bool pvNode,
                   bool check, bool singleReply, bool mateThreat) {
+
     Depth result = Depth(0);
 
-    if(check)
-      result += CheckExtension[pvNode];
-    if(singleReply)
-      result += SingleReplyExtension[pvNode];
-    if(pos.move_is_pawn_push_to_7th(m))
-      result += PawnPushTo7thExtension[pvNode];
-    if(pos.move_is_passed_pawn_push(m))
-      result += PassedPawnExtension[pvNode];
-    if(mateThreat)
-      result += MateThreatExtension[pvNode];
-    if(pos.midgame_value_of_piece_on(move_to(m)) >= RookValueMidgame
-       && (pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)
-           - pos.midgame_value_of_piece_on(move_to(m)) == Value(0))
-       && !move_promotion(m))
-      result += PawnEndgameExtension[pvNode];
-    if(pvNode && pos.move_is_capture(m)
-       && pos.type_of_piece_on(move_to(m)) != PAWN && pos.see(m) >= 0)
-      result += OnePly/2;
+    if (check)
+        result += CheckExtension[pvNode];
+
+    if (singleReply)
+        result += SingleReplyExtension[pvNode];
+
+    if (pos.move_is_pawn_push_to_7th(m))
+        result += PawnPushTo7thExtension[pvNode];
+
+    if (pos.move_is_passed_pawn_push(m))
+        result += PassedPawnExtension[pvNode];
+
+    if (mateThreat)
+        result += MateThreatExtension[pvNode];
+
+    if (   pos.midgame_value_of_piece_on(move_to(m)) >= RookValueMidgame\r
+        && (  pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)\r
+            - pos.midgame_value_of_piece_on(move_to(m)) == Value(0))\r
+        && !move_promotion(m))
+        result += PawnEndgameExtension[pvNode];
+    
+    if (   pvNode
+        && pos.move_is_capture(m)
+        && pos.type_of_piece_on(move_to(m)) != PAWN
+        && pos.see(m) >= 0)
+        result += OnePly/2;
 
     return Min(result, OnePly);
   }