implemented aspiration windows

This commit is contained in:
rektdie committed 2025-03-06 20:17:21 +01:00
1 parent 2db16722f6
commit 4da9654e53
2 files changed
+20 -1

No files matched your search

+19 -1
View File
@@ -252,10 +252,28 @@ static SearchResults ID(Board &board, SearchParams params) {
SearchResults safeResults;
safeResults.score = -inf;
int alpha = -inf;
int beta = inf;
for (int depth = 1; depth <= 99; depth++) {
timeToSearch = (fullTime / 20) + (inc / 2);
SearchResults currentResults = PVS(board, depth, -inf, inf);
SearchResults currentResults = PVS(board, depth, alpha, beta);
// If we fell outside the window, try again with full width
if ((currentResults.score <= alpha)
|| (currentResults.score >= beta)) {
alpha = -inf;
beta = inf;
depth--;
if (searchStopped) break;
continue;
}
alpha = currentResults.score - aspWinConst;
beta = currentResults.score + aspWinConst;
if (currentResults.bestMove) {
safeResults = currentResults;
}