diff --git a/source/search.cpp b/source/search.cpp index 95511d1..d3c6615 100644 --- a/source/search.cpp +++ b/source/search.cpp @@ -12,12 +12,17 @@ namespace SEARCH { void InitLMRTable() { - for (int depth = 0; depth <= MAX_DEPTH; depth++) { - for (int move = 0; move < MAX_MOVES; move++) { - if (depth == 0 || move == 0) { - lmrTable[depth][move] = 0; - } else { - lmrTable[depth][move] = std::floor(lmrBase + std::log(depth) * std::log(move) / lmrDivisor); + for (int i = 0; i < 2; i++) { + const double base = i ? lmrBaseQuiet : lmrBaseNoisy; + const double divisor = i ? lmrDivisorQuiet : lmrDivisorNoisy; + + for (int depth = 0; depth <= MAX_DEPTH; depth++) { + for (int move = 0; move < MAX_MOVES; move++) { + if (depth == 0 || move == 0) { + lmrTable[i][depth][move] = 0; + } else { + lmrTable[i][depth][move] = std::floor(base + std::log(depth) * std::log(move) / divisor); + } } } } @@ -163,7 +168,7 @@ static int GetReductions(Board &board, Move &move, int depth, int moveSeen, int // Late Move Reduction if (depth >= 2 && moveSeen >= 2 + (2 * isPV) && !move.IsCapture()) { - reduction = lmrTable[depth][moveSeen] * 1024; + reduction = lmrTable[move.IsQuiet()][depth][moveSeen] * 1024; if (cutnode) reduction += lmrCutnode; diff --git a/source/search.h b/source/search.h index 3b339b7..98ac16d 100644 --- a/source/search.h +++ b/source/search.h @@ -34,7 +34,8 @@ constexpr int CORRHIST_MAX = 16384; constexpr int32_t ScoreNone = -255000; constexpr int inf = 100000; -inline int lmrTable[MAX_DEPTH+1][MAX_MOVES]; +// first index: [0] noisy, [1] quiet +inline int lmrTable[2][MAX_DEPTH+1][MAX_MOVES]; #ifdef TUNING inline std::array SEEPieceValues = { diff --git a/source/tunables.h b/source/tunables.h index 293d9cd..08a10ad 100644 --- a/source/tunables.h +++ b/source/tunables.h @@ -6,8 +6,10 @@ #define AUTO_STEP(min_val, max_val) ((max_val - min_val) / 20.0) #define TUNABLE_LIST \ - X_DOUBLE(lmrBase, 0.77, 0.5, 1.5) \ - X_DOUBLE(lmrDivisor, 2.36, 1.5, 3.5) \ + X_DOUBLE(lmrBaseQuiet, 1.1, 0.5, 1.5) \ + X_DOUBLE(lmrDivisorQuiet, 2.33, 1.5, 3.5) \ + X_DOUBLE(lmrBaseNoisy, 0.41, 0.5, 1.5) \ + X_DOUBLE(lmrDivisorNoisy, 3.20, 1.5, 3.5) \ X_INT(lmrCutnode, 2048, 1024, 3072) \ X_INT(lmrIsPV, 1024, 512, 2048) \ X_INT(lmrHistoryDivisor, 8192, 6000, 10000) \