From 8261f619644aa50213deb8368094004d0a3be00f Mon Sep 17 00:00:00 2001 From: Joona Kiiski Date: Sun, 7 Feb 2010 10:53:15 +0200 Subject: [PATCH 1/1] Document lookup tables No functional change Signed-off-by: Marco Costalba --- src/search.cpp | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/search.cpp b/src/search.cpp index e1ac91c3..4eabb59f 100644 --- a/src/search.cpp +++ b/src/search.cpp @@ -150,6 +150,23 @@ namespace { // Depth limit for razoring const Depth RazorDepth = 4 * OnePly; + /// Lookup tables initialized at startup + + // Reduction lookup tables 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 < 14? FutilityMarginsMatrix[Max(d, 0)][Min(mn, 63)] : 2*VALUE_INFINITE); } + inline int futility_move_count(Depth d) { return (d < 32? FutilityMoveCountArray[d] : 512); } + /// Variables initialized by UCI options // Depth limit for use of dynamic threat detection @@ -195,22 +212,6 @@ namespace { bool UseLogFile; std::ofstream LogFile; - // 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 < 14? FutilityMarginsMatrix[Max(d, 0)][Min(mn, 63)] : 2*VALUE_INFINITE); } - inline int futility_move_count(Depth d) { return (d < 32? FutilityMoveCountArray[d] : 512); } - - // Reduction lookup tables and their getter functions - // Initialized at startup - 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)]; } - // MP related variables int ActiveThreads = 1; Depth MinimumSplitDepth; -- 2.39.2