X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=81b3f29f335119e4aa7945f689fb68205dca7279;hp=b32016500fb8cccb476a4d2549b3348ebe791f9e;hb=e27d3bb884dc17027010c1ea8f7e7d9efb383d4c;hpb=7ae3c05795e79c9bd945607cdcfb08198f4c4b45 diff --git a/src/search.cpp b/src/search.cpp index b3201650..81b3f29f 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -728,8 +728,7 @@ namespace { && ttMove == MOVE_NONE && eval + razor_margin[depth / ONE_PLY] <= alpha) { - if ( depth <= ONE_PLY - && eval + razor_margin[3 * ONE_PLY] <= alpha) + if (depth <= ONE_PLY) return qsearch(pos, ss, alpha, beta, DEPTH_ZERO); Value ralpha = alpha - razor_margin[depth / ONE_PLY]; @@ -744,7 +743,7 @@ namespace { && eval - futility_margin(depth) >= beta && eval < VALUE_KNOWN_WIN // Do not return unproven wins && pos.non_pawn_material(pos.side_to_move())) - return eval - futility_margin(depth); + return eval; // Step 8. Null move search with verification search (is omitted in PV nodes) if ( !PvNode @@ -890,7 +889,7 @@ moves_loop: // When in check search starts from here // Step 12. Extend checks if ( givesCheck && !moveCountPruning - && pos.see_sign(move) >= VALUE_ZERO) + && pos.see_ge(move, VALUE_ZERO)) extension = ONE_PLY; // Singular extension search. If all moves but one fail low on a search of @@ -920,8 +919,7 @@ moves_loop: // When in check search starts from here // Step 13. Pruning at shallow depth if ( !rootNode - && !inCheck - && bestValue > VALUE_MATED_IN_MAX_PLY) + && bestValue > VALUE_MATED_IN_MAX_PLY) { if ( !captureOrPromotion && !givesCheck @@ -943,16 +941,18 @@ moves_loop: // When in check search starts from here // Futility pruning: parent node if ( lmrDepth < 7 + && !inCheck && ss->staticEval + 256 + 200 * lmrDepth <= alpha) continue; // Prune moves with negative SEE if ( lmrDepth < 8 - && pos.see_sign(move) < Value(-35 * lmrDepth * lmrDepth)) + && !pos.see_ge(move, Value(-35 * lmrDepth * lmrDepth))) continue; } else if ( depth < 7 * ONE_PLY - && pos.see_sign(move) < Value(-35 * depth / ONE_PLY * depth / ONE_PLY)) + && !extension + && !pos.see_ge(move, Value(-35 * depth / ONE_PLY * depth / ONE_PLY))) continue; } @@ -994,7 +994,7 @@ moves_loop: // When in check search starts from here // because the destination square is empty. else if ( type_of(move) == NORMAL && type_of(pos.piece_on(to_sq(move))) != PAWN - && pos.see(make_move(to_sq(move), from_sq(move))) < VALUE_ZERO) + && !pos.see_ge(make_move(to_sq(move), from_sq(move)), VALUE_ZERO)) r -= 2 * ONE_PLY; // Decrease/increase reduction for moves with a good/bad history @@ -1122,6 +1122,9 @@ moves_loop: // When in check search starts from here // All legal moves have been searched and if there are no legal moves, it // must be a mate or a stalemate. If we are in a singular extension search then // return a fail low score. + + assert(moveCount || !inCheck || excludedMove || !MoveList(pos).size()); + if (!moveCount) bestValue = excludedMove ? alpha : inCheck ? mated_in(ss->ply) : DrawValue[pos.side_to_move()]; @@ -1301,7 +1304,7 @@ moves_loop: // When in check search starts from here continue; } - if (futilityBase <= alpha && pos.see(move) <= VALUE_ZERO) + if (futilityBase <= alpha && !pos.see_ge(move, VALUE_ZERO + 1)) { bestValue = std::max(bestValue, futilityBase); continue; @@ -1316,7 +1319,7 @@ moves_loop: // When in check search starts from here // Don't search moves with negative SEE values if ( (!InCheck || evasionPrunable) && type_of(move) != PROMOTION - && pos.see_sign(move) < VALUE_ZERO) + && !pos.see_ge(move, VALUE_ZERO)) continue; // Speculative prefetch as early as possible