Skip to content

Commit fc7e9b7

Browse files
authored
Improving flag via GrandParent nodes. Adjust LMR to use a new formula + legal moves. (#413)
Bench: 4467773 STC ELO | 4.05 +- 3.18 (95%) SPRT | 10.0+0.10s Threads=1 Hash=8MB LLR | 3.00 (-2.94, 2.94) [-0.50, 3.00] GAMES | N: 21336 W: 5099 L: 4850 D: 11387 LTC ELO | 3.37 +- 2.49 (95%) SPRT | 60.0+0.60s Threads=1 Hash=64MB LLR | 2.98 (-2.94, 2.94) [0.00, 3.00] GAMES | N: 32536 W: 7232 L: 6916 D: 18388
1 parent 1476b9d commit fc7e9b7

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

src/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
EXE = berserk
55
SRC = *.c pyrrhic/tbprobe.c
66
CC = gcc
7-
VERSION = 20221001
7+
VERSION = 20221003
88
MAIN_NETWORK = networks/berserk-c982d9682d4e.nn
99
EVALFILE = $(MAIN_NETWORK)
1010
DEFS = -DVERSION=\"$(VERSION)\" -DEVALFILE=\"$(EVALFILE)\" -DNDEBUG

src/search.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ extern volatile int PONDERING;
4949

5050
void InitPruningAndReductionTables() {
5151
for (int depth = 1; depth < MAX_SEARCH_PLY; depth++)
52-
for (int moves = 1; moves < 64; moves++) LMR[depth][moves] = log(depth) * log(moves) / 2 - 0.2;
52+
for (int moves = 1; moves < 64; moves++) LMR[depth][moves] = log(depth) * log(moves) / 2.25 + 0.25;
5353

5454
LMR[0][0] = LMR[0][1] = LMR[1][0] = 0;
5555

@@ -389,8 +389,14 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*
389389
if (!tt) TTPut(board->zobrist, INT8_MIN, UNKNOWN, TT_UNKNOWN, NULL_MOVE, data->ply, eval, ttPv);
390390

391391
// getting better if eval has gone up
392-
int improving = !board->checkers && data->ply >= 2 &&
393-
(data->evals[data->ply] > data->evals[data->ply - 2] || data->evals[data->ply - 2] == UNKNOWN);
392+
int improving = 0;
393+
if (!board->checkers && data->ply >= 2) {
394+
if (data->ply >= 4 && data->evals[data->ply - 2] == UNKNOWN) {
395+
improving = data->evals[data->ply] > data->evals[data->ply - 4] || data->evals[data->ply - 4] == UNKNOWN;
396+
} else {
397+
improving = data->evals[data->ply] > data->evals[data->ply - 2] || data->evals[data->ply - 2] == UNKNOWN;
398+
}
399+
}
394400

395401
// reset moves to moves related to 1 additional ply
396402
data->skipMove[data->ply + 1] = NULL_MOVE;
@@ -560,8 +566,8 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*
560566

561567
// Late move reductions
562568
int R = 1;
563-
if (depth > 2 && playedMoves > 1 && !tactical) {
564-
R = LMR[min(depth, 63)][min(playedMoves, 63)];
569+
if (depth > 2 && legalMoves > 1 && !tactical) {
570+
R = LMR[min(depth, 63)][min(legalMoves, 63)];
565571

566572
// increase reduction on non-pv
567573
if (!ttPv) R++;

0 commit comments

Comments
 (0)