X-Git-Url: https://git.sesse.net/?p=stockfish;a=blobdiff_plain;f=src%2Fsearch.cpp;h=1bf56c8ea59a4ea8190f3e58b182c1ace6610a9e;hp=b269962f9558f006899b5aca06d8973b1153e1c6;hb=5bb9da92872f298e6aedb59d728a42dc5719738e;hpb=fc234662364386800ec728643d7d6da610a560aa diff --git a/src/search.cpp b/src/search.cpp index b269962f..1bf56c8e 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -171,6 +171,9 @@ namespace { // evaluation of the position is more than NullMoveMargin below beta. const Value NullMoveMargin = Value(0x200); + // Depth limit for use of dynamic threat detection when null move fails low + const Depth ThreatDepth = 5 * OnePly; + // Step 9. Internal iterative deepening const Depth IIDDepthAtPVNodes = 5 * OnePly; @@ -195,36 +198,36 @@ namespace { // remaining ones we will extend it. const Value SingularExtensionMargin = Value(0x20); + // Step 12. Futility pruning + const Value FutilityMarginQS = Value(0x80); - // Search depth at iteration 1 - const Depth InitialDepth = OnePly; + // Futility lookup tables (initialized at startup) and their getter functions + int32_t FutilityMarginsMatrix[14][64]; // [depth][moveNumber] + int FutilityMoveCountArray[32]; // [depth] - // Easy move margin. An easy move candidate must be at least this much - // better than the second best move. - const Value EasyMoveMargin = Value(0x200); + inline Value futility_margin(Depth d, int mn) { return Value(d < 7*OnePly ? FutilityMarginsMatrix[Max(d, 0)][Min(mn, 63)] : 2 * VALUE_INFINITE); } + inline int futility_move_count(Depth d) { return d < 16*OnePly ? FutilityMoveCountArray[d] : 512; } - /// Lookup tables initialized at startup + // Step 14. Reduced search - // Reduction lookup tables and their getter functions + // Reduction lookup tables (initialized at startup) and their getter functions int8_t PVReductionMatrix[64][64]; // [depth][moveNumber] int8_t NonPVReductionMatrix[64][64]; // [depth][moveNumber] inline Depth pv_reduction(Depth d, int mn) { return (Depth) PVReductionMatrix[Min(d / 2, 63)][Min(mn, 63)]; } inline Depth nonpv_reduction(Depth d, int mn) { return (Depth) NonPVReductionMatrix[Min(d / 2, 63)][Min(mn, 63)]; } - // Futility lookup tables and their getter functions - const Value FutilityMarginQS = Value(0x80); - int32_t FutilityMarginsMatrix[14][64]; // [depth][moveNumber] - int FutilityMoveCountArray[32]; // [depth] - inline Value futility_margin(Depth d, int mn) { return Value(d < 7*OnePly ? FutilityMarginsMatrix[Max(d, 0)][Min(mn, 63)] : 2 * VALUE_INFINITE); } - inline int futility_move_count(Depth d) { return d < 16*OnePly ? FutilityMoveCountArray[d] : 512; } - /// Variables initialized by UCI options + // Search depth at iteration 1 + const Depth InitialDepth = OnePly; - // Depth limit for use of dynamic threat detection - Depth ThreatDepth; + // Easy move margin. An easy move candidate must be at least this much + // better than the second best move. + const Value EasyMoveMargin = Value(0x200); + + /// Variables initialized by UCI options // Last seconds noise filtering (LSN) const bool UseLSNFiltering = true; @@ -426,8 +429,6 @@ bool think(const Position& pos, bool infinite, bool ponder, int side_to_move, MateThreatExtension[1] = Depth(get_option_value_int("Mate Threat Extension (PV nodes)")); MateThreatExtension[0] = Depth(get_option_value_int("Mate Threat Extension (non-PV nodes)")); - ThreatDepth = get_option_value_int("Threat Depth") * OnePly; - Chess960 = get_option_value_bool("UCI_Chess960"); ShowCurrentLine = get_option_value_bool("UCI_ShowCurrLine"); UseLogFile = get_option_value_bool("Use Search Log"); @@ -1492,7 +1493,7 @@ namespace { continue; // Value based pruning - Depth predictedDepth = newDepth - nonpv_reduction(depth, moveCount); //FIXME: We are ignoring condition: depth >= 3*OnePly, BUG?? + Depth predictedDepth = newDepth - nonpv_reduction(depth, moveCount); // We illogically ignore reduction condition depth >= 3*OnePly futilityValueScaled = ss[ply].eval + futility_margin(predictedDepth, moveCount) + H.gain(pos.piece_on(move_from(move)), move_to(move)) + 45;