Skip to content

Commit 01ba3e1

Browse files
committed
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 b650850 commit 01ba3e1

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
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 = 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
@@ -499,7 +499,7 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*
499499
Move quiets[64];
500500
Move tacticals[64];
501501

502-
int legalMoves = 0, playedMoves = 0, numQuiets = 0, numTacticals = 0, skipQuiets = 0;
502+
int legalMoves = 0, playedMoves = 0, numQuiets = 0, numTacticals = 0, skipQuiets = 0, singularExtension = 0;
503503
InitAllMoves(&moves, hashMove, data, oppThreat.sqs);
504504

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

567567
// no score failed above sBeta, so this is singular
568568
if (score < sBeta) {
569+
singularExtension = 1;
570+
569571
if (!isPV && score < sBeta - 35 && data->de[data->ply - 1] <= 6) {
570572
extension = 2;
571573
data->de[data->ply] = data->de[data->ply - 1] + 1;
@@ -624,7 +626,7 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*
624626
R -= history / 20480;
625627

626628
// prevent dropping into QS, extending, or reducing all extensions
627-
R = min(depth - 1, max(R, 1));
629+
R = min(depth - 1, max(R, !singularExtension));
628630
}
629631

630632
// First move of a PV node
@@ -634,7 +636,7 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*
634636
// potentially reduced search
635637
score = -Negamax(-alpha - 1, -alpha, newDepth - R, 1, thread, &childPv);
636638

637-
if (score > alpha && R != 1) // failed high on a reducede search, try again
639+
if (score > alpha && R > 1) // failed high on a reducede search, try again
638640
score = -Negamax(-alpha - 1, -alpha, newDepth - 1, !cutnode, thread, &childPv);
639641

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

0 commit comments

Comments
 (0)