fn window_unsorted(board: Board, empties: u8, mut alpha: i8, beta: i8) -> i8 {
    if empties == 0 {
        return board.score_absolute_difference();
    }

    let moves = board.get_moves();
    if moves.is_empty() {
        if board.just_passed {
            return board.score_absolute_difference();
        }

        return -window_unsorted(board.pass(), empties, -beta, -alpha);
    }

    for mv in moves {
        let score = -window_unsorted(board.apply_move(mv), empties - 1, -beta, -alpha);

        if score >= beta {
            return beta;
        }

        if score > alpha {
            alpha = score
        }
    }

    alpha
}
/// Window search without move ordering, which is faster for shallow trees.
Window search without move ordering, which is faster for shallow trees.
Window search without move ordering which is faster for shallow trees .
fn window_unsorted(board: Board, empties: u8, mut alpha: i8, beta: i8) -> i8 {
    if empties == 0 {
        return board.score_absolute_difference();
    }
    let moves = board.get_moves();
    if moves.is_empty() {
        if board.just_passed {
            return board.score_absolute_difference();
        }
        return -window_unsorted(board.pass(), empties, -beta, -alpha);
    }
    for mv in moves {
        let score = -window_unsorted(board.apply_move(mv), empties - 1, -beta, -alpha);
        if score >= beta {
            return beta;
        }
        if score > alpha {
            alpha = score
        }
    }
    alpha
}
fn window_unsorted ( board : Board , empties : u8 , mut alpha : i8 , beta : i8 ) -> i8 { if empties == 0 { return board . score_absolute_difference ( ) ; } let moves = board . get_moves ( ) ; if moves . is_empty ( ) { if board . just_passed { return board . score_absolute_difference ( ) ; } return - window_unsorted ( board . pass ( ) , empties , - beta , - alpha ) ; } for mv in moves { let score = - window_unsorted ( board . apply_move ( mv ) , empties - 1 , - beta , - alpha ) ; if score >= beta { return beta ; } if score > alpha { alpha = score } } alpha }
Window search without move ordering, which is faster for shallow trees.
Window search without move ordering which is faster for shallow trees .
board
Board
empties
u8
alpha
i8
beta
i8
board
Board
empties
u8
alpha
i8
beta
i8