Skip to content

Commit

Permalink
Add upper bound to aspiration window.
Browse files Browse the repository at this point in the history
  • Loading branch information
petur committed Mar 1, 2025
1 parent 2a6012e commit 5c18c92
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions seawall.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3892,15 +3892,30 @@ void Search::iterate(int max_depth)
sel_depth = 0;

int alpha = root_depth >= 4 && best_score > -SCORE_WIN ? best_score - 288 : -SCORE_MATE;
auto v = search(true, 0, root_depth, alpha, SCORE_MATE);
int beta = root_depth >= 4 && best_score < SCORE_WIN ? best_score + 144 : SCORE_MATE;
std::pair<int, Move> v;
bool fail_high = false;

if (alpha > -SCORE_MATE && v.first <= alpha && !check_time(changes, improving))
for (;;)
{
print_info(root_depth, v.first, true);

auto vv = search(true, 0, root_depth, -SCORE_MATE, SCORE_MATE);
auto vv = search(true, 0, root_depth - fail_high, alpha, beta);
if (vv.second)
v = vv;
if (check_time(changes, improving))
break;
if (alpha > -SCORE_MATE && vv.first <= alpha)
{
alpha = -SCORE_MATE;
fail_high = false;
}
else if (beta < SCORE_MATE && vv.first >= beta)
{
beta = SCORE_MATE;
fail_high = true;
}
else
break;
print_info(root_depth, vv.first, true);
}

if (v.second)
Expand Down

0 comments on commit 5c18c92

Please sign in to comment.