Skip to content

Commit

Permalink
Merge branch 'main' into tm-spsa
Browse files Browse the repository at this point in the history
Bench: 3556179
  • Loading branch information
jhonnold committed Sep 26, 2023
2 parents a722c1c + fadab01 commit f1c8ae0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
EXE = berserk
SRC = *.c nn/*.c pyrrhic/tbprobe.c
CC = gcc
VERSION = 20230919
VERSION = 20230925
MAIN_NETWORK = networks/berserk-1968dc235247.nn
EVALFILE = $(MAIN_NETWORK)
DEFS = -DVERSION=\"$(VERSION)\" -DEVALFILE=\"$(EVALFILE)\" -DNDEBUG
Expand Down
16 changes: 9 additions & 7 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,6 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*
// apply extensions
int newDepth = depth + extension;

int doFullSearch = 0;

// Late move reductions
if (depth > 2 && legalMoves > 1 && !(isPV && IsCap(move))) {
int R = LMR[Min(depth, 63)][Min(legalMoves, 63)];
Expand Down Expand Up @@ -677,13 +675,14 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*

score = -Negamax(-alpha - 1, -alpha, newDepth - R, 1, thread, &childPv, ss + 1);

doFullSearch = score > alpha && R > 1;
} else {
doFullSearch = !isPV || playedMoves > 1;
}
if (score > alpha && R > 1) {
newDepth += (score > bestScore + 75);

if (doFullSearch)
score = -Negamax(-alpha - 1, -alpha, newDepth - 1, !cutnode, thread, &childPv, ss + 1);
}
} else if (!isPV || playedMoves > 1) {
score = -Negamax(-alpha - 1, -alpha, newDepth - 1, !cutnode, thread, &childPv, ss + 1);
}

if (isPV && (playedMoves == 1 || (score > alpha && (isRoot || score < beta))))
score = -Negamax(-beta, -alpha, newDepth - 1, 0, thread, &childPv, ss + 1);
Expand Down Expand Up @@ -724,6 +723,9 @@ int Negamax(int alpha, int beta, int depth, int cutnode, ThreadData* thread, PV*
if (score > alpha) {
bestMove = move;
alpha = score;

if (alpha < beta && score > -TB_WIN_BOUND)
depth -= (depth >= 2 && depth <= 10);
}

// we're failing high
Expand Down

0 comments on commit f1c8ae0

Please sign in to comment.