Add PVS
This commit is contained in:
@@ -51,7 +51,17 @@ pub fn negamax(
|
|||||||
}
|
}
|
||||||
|
|
||||||
legal_moves += 1;
|
legal_moves += 1;
|
||||||
let score = -negamax(game, -beta, -alpha, depth - 1, plies + 1, time_info)?;
|
|
||||||
|
let score = if legal_moves == 1 {
|
||||||
|
-negamax(game, -beta, -alpha, depth - 1, plies + 1, time_info)?
|
||||||
|
} else {
|
||||||
|
let mut score = -negamax(game, -alpha - 1, -alpha, depth - 1, plies + 1, time_info)?;
|
||||||
|
if score > alpha && score < beta {
|
||||||
|
score = -negamax(game, -beta, -alpha, depth - 1, plies + 1, time_info)?;
|
||||||
|
}
|
||||||
|
score
|
||||||
|
};
|
||||||
|
|
||||||
game.unmake_move();
|
game.unmake_move();
|
||||||
|
|
||||||
if score > best_score {
|
if score > best_score {
|
||||||
|
|||||||
Reference in New Issue
Block a user