Issues with Aspiration Windows

Discussion of chess software programming and technical issues.

Moderator: Ras

zirconium
Posts: 1
Joined: Thu May 08, 2025 9:24 pm
Full name: Rasmus Liaskar

Issues with Aspiration Windows

Post by zirconium »

I recently (2 months ago) tried to implement aspiration windows with terrible success this is a short match (500 games) against the previous version without aspiration windows. I failed horribly with a score of just 43.7%.

Code: Select all

--------------------------------------------------
Results of ferrischess_aspiration vs ferrischess (8+0.16, NULL, NULL, 8moves_v3.pgn):
Elo: -43.99 +/- 20.43, nElo: -64.33 +/- 29.52
LOS: 0.00 %, DrawRatio: 50.75 %, PairsRatio: 0.51
Games: 532, Wins: 148, Losses: 215, Draws: 169, Points: 232.5 (43.70 %)
Ptnml(0-2): [34, 53, 135, 34, 10], WL/DD Ratio: 2.29
LLR: -2.97 (-100.9%) (-2.94, 2.94) [0.00, 10.00]
--------------------------------------------------
SPRT ([0.00, 10.00]) completed - H0 was accepted
Finished match
Total Time: 00:33:57 (hours:minutes:seconds)
I was wondering if someone could take a look at my start_search function, since I'm sure my implementation is sh*t.

https://github.com/Zirconium419122/ferr ... ch.rs#L103

Here is the most relevant part of start_search:

Code: Select all

const WINDOWS: [i32; 4] = [
    20,
    80,
    320,
    INFINITY,
];

let mut evaluation = 0;

self.think_timer = Instant::now();
for depth in 1..=search_depth {
    self.search_depth = depth;

    let mut tries = 1;

    let (mut alpha, mut beta) = if depth > 6 {
        (evaluation - WINDOWS[0], evaluation + WINDOWS[0])
    } else {
        (-INFINITY, INFINITY)
    };

    loop {
        (self.evaluation_iteration, self.best_move_iteration) =
            self.search_base(alpha, beta);

        evaluation = self.evaluation_iteration;

        if evaluation <= alpha && tries < WINDOWS.len() - 1 {
            alpha = evaluation.saturating_sub(WINDOWS[tries]);
            tries += 1;

            continue;
        }
        if evaluation >= beta && tries < WINDOWS.len() - 1 {
            beta = evaluation.saturating_add(WINDOWS[tries]);
            tries += 1;

            continue;
        }

        if self.best_move_iteration != Search::NULL_MOVE {
            self.pv = self.pv_iteration.clone();
            self.evaluation = self.evaluation_iteration;
            self.best_move = self.best_move_iteration;
        }

        break;
    }

    if self.cancelled {
        break;
    }
}