Skip to content

Commit 8cae7ac

Browse files
authored
Introduce negative reductions when hash move is singular (#424)
Bench: 4452548 This is a play on the idea of singular quiet lmr found in stockfish. STC ELO | 2.13 +- 1.71 (95%) SPRT | 10.0+0.10s Threads=1 Hash=8MB LLR | 2.95 (-2.94, 2.94) [0.00, 3.00] GAMES | N: 73080 W: 17185 L: 16738 D: 39157 LTC ELO | 3.01 +- 2.30 (95%) SPRT | 60.0+0.60s Threads=1 Hash=64MB LLR | 2.95 (-2.94, 2.94) [0.00, 3.00] GAMES | N: 38208 W: 8520 L: 8189 D: 21499
1 parent 761f18b commit 8cae7ac

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

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 = 20221206
7+
VERSION = 20221208
88
MAIN_NETWORK = networks/berserk-c982d9682d4e.nn
99
EVALFILE = $(MAIN_NETWORK)
1010
DEFS = -DVERSION=\"$(VERSION)\" -DEVALFILE=\"$(EVALFILE)\" -DNDEBUG

src/search.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*
472472
Move quiets[64];
473473
Move tacticals[64];
474474

475-
int legalMoves = 0, playedMoves = 0, numQuiets = 0, numTacticals = 0, skipQuiets = 0;
475+
int legalMoves = 0, playedMoves = 0, numQuiets = 0, numTacticals = 0, skipQuiets = 0, singularExtension = 0;
476476
InitAllMoves(&moves, hashMove, data, oppThreat.sqs);
477477

478478
while ((move = NextMove(&moves, board, skipQuiets))) {
@@ -533,6 +533,8 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*
533533

534534
// no score failed above sBeta, so this is singular
535535
if (score < sBeta) {
536+
singularExtension = 1;
537+
536538
if (!isPV && score < sBeta - 35 && data->de[data->ply - 1] <= 6) {
537539
extension = 2;
538540
data->de[data->ply] = data->de[data->ply - 1] + 1;
@@ -591,7 +593,7 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*
591593
R -= history / 20480;
592594

593595
// prevent dropping into QS, extending, or reducing all extensions
594-
R = min(depth - 1, max(R, 1));
596+
R = min(depth - 1, max(R, !singularExtension));
595597
}
596598

597599
// First move of a PV node
@@ -601,7 +603,7 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*
601603
// potentially reduced search
602604
score = -Negamax(-alpha - 1, -alpha, newDepth - R, 1, thread, &childPv);
603605

604-
if (score > alpha && R != 1) // failed high on a reducede search, try again
606+
if (score > alpha && R > 1) // failed high on a reducede search, try again
605607
score = -Negamax(-alpha - 1, -alpha, newDepth - 1, !cutnode, thread, &childPv);
606608

607609
if (score > alpha && (isRoot || score < beta)) // failed high again, do full window

0 commit comments

Comments
 (0)