X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=ada0cd5b04b8797e2c1c5649b218a13ed0e8c692;hp=176006fcc1073ea837b04b27dcdcc8d3ace22e0e;hb=194048503020ad35e221c36fd8817f569b728310;hpb=759b3c79cf94d101163f646b1eb2a9f9c64293ab diff --git a/src/search.cpp b/src/search.cpp index 176006fc..ada0cd5b 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -67,8 +67,7 @@ namespace { constexpr int SkipPhase[] = { 0, 1, 0, 1, 2, 3, 0, 1, 2, 3, 4, 5, 0, 1, 2, 3, 4, 5, 6, 7 }; // Razor and futility margins - constexpr int RazorMargin1 = 590; - constexpr int RazorMargin2 = 604; + constexpr int RazorMargin[] = {0, 590, 604}; Value futility_margin(Depth d, bool improving) { return Value((175 - 50 * improving) * d / ONE_PLY); } @@ -690,21 +689,13 @@ namespace { // Step 7. Razoring (skipped when in check) if ( !PvNode - && depth <= 2 * ONE_PLY) + && depth <= 2 * ONE_PLY + && eval <= alpha - Value(RazorMargin[depth / ONE_PLY])) { - if ( depth == ONE_PLY - && eval + RazorMargin1 <= alpha) - return qsearch(pos, ss, alpha, alpha+1); - - else if (eval + RazorMargin2 <= alpha) - { - Value ralpha = alpha - RazorMargin2; - - Value v = qsearch(pos, ss, ralpha, ralpha+1); - - if (v <= ralpha) - return v; - } + Value ralpha = alpha - Value((depth != ONE_PLY) * RazorMargin[depth / ONE_PLY]); + Value v = qsearch(pos, ss, ralpha, ralpha+1); + if (depth == ONE_PLY || v <= ralpha) + return v; } // Step 8. Futility pruning: child node (skipped when in check)