Aspiration windows #11

Merged
rektdie merged 2 commits from aspiration_windows into legalMovegen 2025-03-06 22:12:55 +01:00
2 changed files with 20 additions and 1 deletions
Showing only changes of commit 4da9654e53 - Show all commits

No files matched your search

+19 -1
View File
@@ -252,10 +252,28 @@ static SearchResults ID(Board &board, SearchParams params) {
SearchResults safeResults; SearchResults safeResults;
safeResults.score = -inf; safeResults.score = -inf;
int alpha = -inf;
int beta = inf;
for (int depth = 1; depth <= 99; depth++) { for (int depth = 1; depth <= 99; depth++) {
timeToSearch = (fullTime / 20) + (inc / 2); 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) { if (currentResults.bestMove) {
safeResults = currentResults; safeResults = currentResults;
} }
+1
View File
@@ -8,6 +8,7 @@ extern bool benchStarted;
constexpr int invalidEntry = 111111; constexpr int invalidEntry = 111111;
constexpr int inf = 100000; constexpr int inf = 100000;
constexpr int aspWinConst = 50;
class SearchResults { class SearchResults {
public: public: