Lmr #23

Merged
rektdie merged 2 commits from LMR into main 2025-03-18 22:58:49 +01:00
Showing only changes of commit 62ca23627f - Show all commits
+8 -4
View File
@@ -2,6 +2,7 @@
#include "movegen.h" #include "movegen.h"
#include "evaluate.h" #include "evaluate.h"
#include <algorithm> #include <algorithm>
#include <cmath>
#include "tt.h" #include "tt.h"
#include "stopwatch.h" #include "stopwatch.h"
@@ -95,12 +96,15 @@ static bool IsThreefold(Board &board) {
return false; return false;
} }
static int GetReductions(Board &board, int depth, int moveSeen) { static int GetReductions(Board &board, int depth, int moveSeen, int ply) {
int reduction = 0; int reduction = 0;
// Late Move Reduction // Late Move Reduction
if (!board.InCheck(board.sideToMove) && moveSeen >= 5 && depth > 3) { if (depth >= 3 && moveSeen >= 5 + 2 * (ply == 0) && !board.InCheck(board.sideToMove)) {
reduction++; double base = 0.77;
double divisor = 2.36;
reduction = std::round(base + std::log(depth) * std::log(moveSeen) / divisor);
} }
return reduction; return reduction;
@@ -229,7 +233,7 @@ SearchResults PVS(Board board, int depth, int alpha, int beta, int ply) {
Board copy = board; Board copy = board;
copy.MakeMove(currMove); copy.MakeMove(currMove);
int reductions = GetReductions(board, depth, i); int reductions = GetReductions(board, depth, i, ply);
// First move (suspected PV node) // First move (suspected PV node)
if (!i) { if (!i) {