]> git.sesse.net Git - stockfish/commitdiff
Do not razor while in check or value is mate
authorMarco Costalba <mcostalba@gmail.com>
Mon, 15 Dec 2008 15:47:30 +0000 (16:47 +0100)
committerMarco Costalba <mcostalba@gmail.com>
Mon, 15 Dec 2008 21:20:03 +0000 (22:20 +0100)
Signed-off-by: Marco Costalba <mcostalba@gmail.com>
src/search.cpp

index cbb6ea0980a6f6c005c31ee62d45ef862dcb271f..017f65be3984d30c312679164d47431d4fc441a1 100644 (file)
@@ -1195,6 +1195,7 @@ namespace {
         if (   UseNullDrivenIID
             && nullValue < beta
             && depth > 6 * OnePly
         if (   UseNullDrivenIID
             && nullValue < beta
             && depth > 6 * OnePly
+            &&!value_is_mate(nullValue)
             && ttMove == MOVE_NONE
             && ss[ply + 1].currentMove != MOVE_NONE
             && pos.move_is_capture(ss[ply + 1].currentMove)
             && ttMove == MOVE_NONE
             && ss[ply + 1].currentMove != MOVE_NONE
             && pos.move_is_capture(ss[ply + 1].currentMove)
@@ -1236,8 +1237,10 @@ namespace {
         }
     }
     // Null move search not allowed, try razoring
         }
     }
     // Null move search not allowed, try razoring
-    else if (  (approximateEval < beta - RazorMargin && depth < RazorDepth)
-             ||(approximateEval < beta - PawnValueMidgame && depth <= OnePly))
+    else if (   !isCheck
+             && !value_is_mate(beta)
+             && (  (approximateEval < beta - RazorMargin && depth < RazorDepth)
+                 ||(approximateEval < beta - PawnValueMidgame && depth <= OnePly)))
     {
         Value v = qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);
         if (v < beta)
     {
         Value v = qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID);
         if (v < beta)
@@ -1454,12 +1457,12 @@ namespace {
     // Initialize a MovePicker object for the current position, and prepare
     // to search the moves.  Because the depth is <= 0 here, only captures,
     // queen promotions and checks (only if depth == 0) will be generated.
     // Initialize a MovePicker object for the current position, and prepare
     // to search the moves.  Because the depth is <= 0 here, only captures,
     // queen promotions and checks (only if depth == 0) will be generated.
-    MovePicker mp = MovePicker(pos, false, MOVE_NONE, EmptySearchStack, depth, &ei);
+    bool pvNode = (beta - alpha != 1);
+    MovePicker mp = MovePicker(pos, pvNode, MOVE_NONE, EmptySearchStack, depth, &ei);
     Move move;
     int moveCount = 0;
     Bitboard dcCandidates = mp.discovered_check_candidates();
     bool isCheck = pos.is_check();
     Move move;
     int moveCount = 0;
     Bitboard dcCandidates = mp.discovered_check_candidates();
     bool isCheck = pos.is_check();
-    bool pvNode = (beta - alpha != 1);
     bool enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
 
     // Loop through the moves until no moves remain or a beta cutoff
     bool enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame;
 
     // Loop through the moves until no moves remain or a beta cutoff