Skip to content

Commit

Permalink
Bench: 18865497
Browse files Browse the repository at this point in the history
  • Loading branch information
TerjeKir committed Oct 24, 2023
1 parent 85a777d commit b1103bd
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/search.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,9 @@ static int Quiescence(Thread *thread, Stack *ss, int alpha, const int beta) {
Move move;
while ((move = NextMove(&mp))) {

// Recursively search the positions after making the moves, skipping illegal ones
if (!MoveIsLegal(pos, move)) continue;

// Avoid pruning until at least one move avoids a terminal loss score
if (bestScore <= -TBWIN_IN_MAX) goto search;

Expand All @@ -161,8 +164,6 @@ static int Quiescence(Thread *thread, Stack *ss, int alpha, const int beta) {
search:
ss->continuation = &thread->continuation[inCheck][moveIsCapture(move)][piece(move)][toSq(move)];

// Recursively search the positions after making the moves, skipping illegal ones
if (!MoveIsLegal(pos, move)) continue;
MakeMove(pos, move);
int score = -Quiescence(thread, ss+1, -beta, -alpha);
TakeMove(pos);
Expand Down Expand Up @@ -402,6 +403,9 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth
if (root && AlreadySearchedMultiPV(thread, move)) continue;
if (root && NotInSearchMoves(move)) continue;

// Skip to the next move if this one is illegal
if (!MoveIsLegal(pos, move)) continue;

bool quiet = moveIsQuiet(move);

ss->histScore = GetHistory(thread, ss, move);
Expand All @@ -427,9 +431,6 @@ static int AlphaBeta(Thread *thread, Stack *ss, int alpha, int beta, Depth depth
continue;
}

// Skip to the next move if this one is illegal
if (!MoveIsLegal(pos, move)) continue;

moveCount++;

// Extension
Expand Down

0 comments on commit b1103bd

Please sign in to comment.