Skip to content

Commit c54fe2c

Browse files
committed
feat: aspiration window
1 parent eaea7da commit c54fe2c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/search.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ class Searcher {
137137

138138
Value alpha = Value::matedIn(0);
139139
Value beta = Value::mateIn(0);
140+
Value window = 50;
140141
Value bestEvalRoot = Value::none();
141142
Move bestMoveRoot = Move::NO_MOVE;
142143

@@ -168,6 +169,24 @@ class Searcher {
168169
break;
169170
}
170171

172+
// Aspiration window
173+
if (stats.depth >= 3) {
174+
if (score <= alpha) {
175+
beta = (alpha + beta) / 2;
176+
alpha = alpha - window;
177+
window = window * 2;
178+
continue;
179+
}
180+
if (score >= beta) {
181+
beta += window;
182+
window = window * 2;
183+
continue;
184+
}
185+
window = 50;
186+
alpha = score - window;
187+
beta = score + window;
188+
}
189+
171190
stats.depth++;
172191
}
173192

0 commit comments

Comments
 (0)