Convert minimax to negamax and implement alpha-beta pruning
This commit is contained in:
@@ -3,7 +3,12 @@ use std::{
|
||||
str::SplitWhitespace,
|
||||
};
|
||||
|
||||
use crate::{board::game::Game, movegen::r#move::Move, search};
|
||||
use crate::{
|
||||
board::game::Game,
|
||||
evaluation::evaluation::{MAX_EVAL, MIN_EVAL},
|
||||
movegen::r#move::Move,
|
||||
search,
|
||||
};
|
||||
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
pub enum Command {
|
||||
@@ -132,11 +137,15 @@ pub fn uci_go(go: &mut SplitWhitespace, game: &mut Game) -> Result<Move, String>
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
Ok(
|
||||
search::minimax::minimax(game, params.depth.unwrap_or(MAX_DEPTH))
|
||||
.0
|
||||
.expect("No move selected"),
|
||||
Ok(search::negamax::negamax(
|
||||
game,
|
||||
MIN_EVAL,
|
||||
MAX_EVAL,
|
||||
params.depth.unwrap_or(MAX_DEPTH),
|
||||
0,
|
||||
)
|
||||
.0
|
||||
.expect("No move selected"))
|
||||
}
|
||||
|
||||
pub fn uci_loop<R: BufRead, W: Write>(input: R, mut output: W) -> Result<(), String> {
|
||||
|
||||
Reference in New Issue
Block a user