X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=45e0888d5efbfb58493075fb0b1c6699615046f6;hp=54ff467c1e563314ffed6804744fb1226ee555cf;hb=c97104e8540b72ee2c6c9c13d3773d2c0f9ec32f;hpb=8cd5cb930dd6737220ed83f787062cac13270298 diff --git a/src/search.cpp b/src/search.cpp index 54ff467c..45e0888d 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -162,13 +162,14 @@ namespace { bool UseQSearchFutilityPruning = true; bool UseFutilityPruning = true; - // Margins for futility pruning in the quiescence search, at frontier - // nodes, and at pre-frontier nodes - Value FutilityMargin0 = Value(0x80); - Value FutilityMargin1 = Value(0x100); - Value FutilityMargin2 = Value(0x200); + // Margins for futility pruning in the quiescence search, and at frontier + // and near frontier nodes + Value FutilityMarginQS = Value(0x80); + Value FutilityMargins[6] = { Value(0x100), Value(0x200), Value(0x250), + Value(0x2A0), Value(0x340), Value(0x3A0) }; // Razoring + const bool RazorAtDepthOne = false; Depth RazorDepth = 4*OnePly; Value RazorMargin = Value(0x300); @@ -415,9 +416,10 @@ void think(const Position &pos, bool infinite, bool ponder, int side_to_move, UseQSearchFutilityPruning = get_option_value_bool("Futility Pruning (Quiescence Search)"); UseFutilityPruning = get_option_value_bool("Futility Pruning (Main Search)"); - FutilityMargin0 = value_from_centipawns(get_option_value_int("Futility Margin 0")); - FutilityMargin1 = value_from_centipawns(get_option_value_int("Futility Margin 1")); - FutilityMargin2 = value_from_centipawns(get_option_value_int("Futility Margin 2")); + FutilityMarginQS = value_from_centipawns(get_option_value_int("Futility Margin (Quiescence Search)")); + int fmScale = get_option_value_int("Futility Margin Scale Factor (Main Search)"); + for (int i = 0; i < 6; i++) + FutilityMargins[i] = (FutilityMargins[i] * fmScale) / 100; RazorDepth = (get_option_value_int("Maximum Razoring Depth") + 1) * OnePly; RazorMargin = value_from_centipawns(get_option_value_int("Razoring Margin")); @@ -447,7 +449,6 @@ void think(const Position &pos, bool infinite, bool ponder, int side_to_move, // Set thinking time: int myTime = time[side_to_move]; int myIncrement = increment[side_to_move]; - int oppTime = time[1 - side_to_move]; if (!movesToGo) // Sudden death time control { @@ -1240,12 +1241,14 @@ namespace { else if ( !value_is_mate(beta) && approximateEval < beta - RazorMargin && depth < RazorDepth - && depth > OnePly + && (RazorAtDepthOne || depth > OnePly) && ttMove == MOVE_NONE && !pos.has_pawn_on_7th(pos.side_to_move())) { Value v = qsearch(pos, ss, beta-1, beta, Depth(0), ply, threadID); - if (v < beta - RazorMargin / 2 - int(depth - OnePly) * RazorMargin / 8) + if ( (v < beta - RazorMargin - RazorMargin / 4) + || (depth < 3*OnePly && v < beta - RazorMargin) + || (depth < 2*OnePly && v < beta - RazorMargin / 2)) return v; } @@ -1321,9 +1324,8 @@ namespace { { if (futilityValue == VALUE_NONE) futilityValue = evaluate(pos, ei, threadID) - + (depth < 2 * OnePly ? FutilityMargin1 : - + (depth < 6 * OnePly ? FutilityMargin2 + (depth - 2*OnePly) * 32 - : FutilityMargin2 + (depth - 2*OnePly) * 64)); + + FutilityMargins[int(depth)/2 - 1] + + 32 * (depth & 1); if (futilityValue < beta) { @@ -1494,7 +1496,7 @@ namespace { + Max(pos.midgame_value_of_piece_on(move_to(move)), pos.endgame_value_of_piece_on(move_to(move))) + (move_is_ep(move) ? PawnValueEndgame : Value(0)) - + FutilityMargin0 + + FutilityMarginQS + ei.futilityMargin; if (futilityValue < alpha) @@ -2193,15 +2195,18 @@ namespace { if (mateThreat) result += MateThreatExtension[pvNode]; - if (pos.move_is_pawn_push_to_7th(m)) + if (pos.type_of_piece_on(move_from(m)) == PAWN) { - result += PawnPushTo7thExtension[pvNode]; - *dangerous = true; - } - if (pos.move_is_passed_pawn_push(m)) - { - result += PassedPawnExtension[pvNode]; - *dangerous = true; + if (pos.move_is_pawn_push_to_7th(m)) + { + result += PawnPushTo7thExtension[pvNode]; + *dangerous = true; + } + if (pos.move_is_passed_pawn_push(m)) + { + result += PassedPawnExtension[pvNode]; + *dangerous = true; + } } if ( pos.move_is_capture(m)