init bestScore to staticScore in QS | bench 3786359

This commit is contained in:
rektdie committed 2025-03-09 05:03:31 +01:00
1 parent 15676a09e0
commit ec9c2e7348
1 file changed
+2 -5
+2 -5
View File
@@ -95,15 +95,12 @@ static SearchResults Quiescence(Board board, int alpha, int beta) {
} }
int staticScore = Evaluate(board); int staticScore = Evaluate(board);
int bestScore = alpha;
if (staticScore >= beta) { if (staticScore >= beta) {
return staticScore; return staticScore;
} }
if (staticScore > bestScore) { int bestScore = staticScore;
bestScore = staticScore;
}
GenerateMoves(board, board.sideToMove); GenerateMoves(board, board.sideToMove);
@@ -115,7 +112,7 @@ static SearchResults Quiescence(Board board, int alpha, int beta) {
if (board.moveList[i].IsCapture()) { if (board.moveList[i].IsCapture()) {
Board copy = board; Board copy = board;
copy.MakeMove(board.moveList[i]); copy.MakeMove(board.moveList[i]);
int score = -Quiescence(copy, -beta, -bestScore).score; int score = -Quiescence(copy, -beta, -alpha).score;
if (score >= beta) { if (score >= beta) {
return score; return score;