]> git.sesse.net Git - stockfish/blobdiff - src/search.cpp
Try only recaptures in qsearch if depth is very low
[stockfish] / src / search.cpp
index b9fdcea119a51b4761ebf94c3a2eacdc250991ff..50dfcc0ced1dc210acb6bf8cb23ffe9c7e6458e7 100644 (file)
@@ -763,7 +763,7 @@ namespace {
 
     // Step 2. Check for aborted search and immediate draw
     if ((   StopRequest
-         || pos.is_draw()
+         || pos.is_draw<false>()
          || ss->ply > PLY_MAX) && !RootNode)
         return VALUE_DRAW;
 
@@ -1134,7 +1134,7 @@ split_point_start: // At split points actual search starts from here
           bool doFullDepthSearch = true;
           alpha = SpNode ? sp->alpha : alpha;
 
-          if (    depth >= 3 * ONE_PLY
+          if (    depth > 3 * ONE_PLY
               && !captureOrPromotion
               && !dangerous
               && !move_is_castle(move)
@@ -1333,7 +1333,7 @@ split_point_start: // At split points actual search starts from here
     ss->ply = (ss-1)->ply + 1;
 
     // Check for an instant draw or maximum ply reached
-    if (ss->ply > PLY_MAX || pos.is_draw())
+    if (pos.is_draw<true>() || ss->ply > PLY_MAX)
         return VALUE_DRAW;
 
     // Decide whether or not to include checks, this fixes also the type of
@@ -1372,8 +1372,6 @@ split_point_start: // At split points actual search starts from here
         else
             ss->eval = bestValue = evaluate(pos, evalMargin);
 
-        update_gains(pos, (ss-1)->currentMove, (ss-1)->eval, ss->eval);
-
         // Stand pat. Return immediately if static value is at least beta
         if (bestValue >= beta)
         {
@@ -1395,7 +1393,7 @@ split_point_start: // At split points actual search starts from here
     // to search the moves. Because the depth is <= 0 here, only captures,
     // queen promotions and checks (only if depth >= DEPTH_QS_CHECKS) will
     // be generated.
-    MovePicker mp(pos, ttMove, depth, H);
+    MovePicker mp(pos, ttMove, depth, H, move_to((ss-1)->currentMove));
     CheckInfo ci(pos);
     Bitboard pinned = pos.pinned_pieces(pos.side_to_move());
 
@@ -2019,7 +2017,7 @@ split_point_start: // At split points actual search starts from here
            && pos.move_is_pl(tte->move())
            && pos.pl_move_is_legal(tte->move(), pos.pinned_pieces(pos.side_to_move()))
            && ply < PLY_MAX
-           && (!pos.is_draw() || ply < 2))
+           && (!pos.is_draw<false>() || ply < 2))
     {
         pv[ply] = tte->move();
         pos.do_move(pv[ply++], *st++);