X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=d54794bbc8712205a066cf977da4f692b3cb4c02;hp=e1245085cdc880608a21af043de6dcf695d35a73;hb=7733dadfd7c8781e3bde3cc4e21751fa44ab6ed8;hpb=9d1522b24f24f0bb37425cb5bb2087d622faa58e diff --git a/src/search.cpp b/src/search.cpp index e1245085..d54794bb 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -52,9 +52,6 @@ using std::endl; namespace { - // Maximum number of allowed moves per position - const int MOVES_MAX = 256; - // Types enum NodeType { NonPV, PV }; @@ -366,7 +363,7 @@ void init_search() { // Init futility move count array for (d = 0; d < 32; d++) - FutilityMoveCountArray[d] = 3 + (1 << (3 * d / 8)); + FutilityMoveCountArray[d] = int(3.001 + 0.25 * pow(d, 2.0)); } @@ -633,7 +630,7 @@ namespace { // Add some extra time if the best move has changed during the last two iterations if (Iteration > 5 && Iteration <= 50) - TimeMgr.pv_unstability(BestMoveChangesByIteration[Iteration], + TimeMgr.pv_instability(BestMoveChangesByIteration[Iteration], BestMoveChangesByIteration[Iteration-1]); // Stop search if most of MaxSearchTime is consumed at the end of the @@ -1434,12 +1431,11 @@ namespace { assert(tte->static_value() != VALUE_NONE); evalMargin = tte->static_value_margin(); - bestValue = tte->static_value(); + ss->eval = bestValue = tte->static_value(); } else - bestValue = evaluate(pos, evalMargin); + ss->eval = bestValue = evaluate(pos, evalMargin); - ss->eval = bestValue; update_gains(pos, (ss-1)->currentMove, (ss-1)->eval, ss->eval); // Stand pat. Return immediately if static value is at least beta @@ -1458,7 +1454,7 @@ namespace { deepChecks = (depth == -ONE_PLY && bestValue >= beta - PawnValueMidgame / 8); // Futility pruning parameters, not needed when in check - futilityBase = bestValue + FutilityMarginQS + evalMargin; + futilityBase = ss->eval + evalMargin + FutilityMarginQS; enoughMaterial = pos.non_pawn_material(pos.side_to_move()) > RookValueMidgame; } @@ -1498,7 +1494,7 @@ namespace { } } - // Detect blocking evasions that are candidate to be pruned + // Detect non-capture evasions that are candidate to be pruned evasionPrunable = isCheck && bestValue > value_mated_in(PLY_MAX) && !pos.move_is_capture(move) @@ -1544,11 +1540,6 @@ namespace { ValueType vt = (bestValue <= oldAlpha ? VALUE_TYPE_UPPER : bestValue >= beta ? VALUE_TYPE_LOWER : VALUE_TYPE_EXACT); TT.store(pos.get_key(), value_to_tt(bestValue, ply), vt, d, ss->bestMove, ss->eval, evalMargin); - // Update killers only for checking moves that fails high - if ( bestValue >= beta - && !pos.move_is_capture_or_promotion(ss->bestMove)) - update_killers(ss->bestMove, ss); - assert(bestValue > -VALUE_INFINITE && bestValue < VALUE_INFINITE); return bestValue;