first working
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
pub mod mcts;
|
||||
mod net;
|
||||
mod train;
|
||||
pub mod training;
|
||||
|
||||
use chess::Game;
|
||||
|
||||
pub const DEFAULT_MAX_DEPTH: u16 = 6;
|
||||
pub const DEFAULT_PLAYER_TIME_REMAINING_MS: u64 = 120_000; // 2 minutes
|
||||
pub const DEFAULT_PLAYER_INCREMENT_MS: u64 = 0;
|
||||
|
||||
pub struct Engine {
|
||||
pub game: Game,
|
||||
pub search_settings: SearchSettings,
|
||||
}
|
||||
|
||||
pub struct SearchSettings {
|
||||
pub wtime: u64,
|
||||
pub btime: u64,
|
||||
pub winc: u64,
|
||||
pub binc: u64,
|
||||
pub movetime: Option<u64>,
|
||||
pub max_depth: Option<u16>,
|
||||
pub max_nodes: Option<usize>,
|
||||
}
|
||||
|
||||
impl Default for SearchSettings {
|
||||
fn default() -> Self {
|
||||
SearchSettings::new(None, None, None, None, None, None, None)
|
||||
}
|
||||
}
|
||||
|
||||
impl SearchSettings {
|
||||
pub fn new(
|
||||
wtime: Option<u64>,
|
||||
btime: Option<u64>,
|
||||
winc: Option<u64>,
|
||||
binc: Option<u64>,
|
||||
movetime: Option<u64>,
|
||||
max_depth: Option<u16>,
|
||||
max_nodes: Option<usize>,
|
||||
) -> Self {
|
||||
SearchSettings {
|
||||
wtime: wtime.unwrap_or(DEFAULT_PLAYER_TIME_REMAINING_MS),
|
||||
btime: btime.unwrap_or(DEFAULT_PLAYER_TIME_REMAINING_MS),
|
||||
winc: winc.unwrap_or(DEFAULT_PLAYER_INCREMENT_MS),
|
||||
binc: binc.unwrap_or(DEFAULT_PLAYER_INCREMENT_MS),
|
||||
movetime,
|
||||
max_depth,
|
||||
max_nodes,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Engine {
|
||||
fn default() -> Self {
|
||||
Engine::new(None)
|
||||
}
|
||||
}
|
||||
|
||||
impl Engine {
|
||||
pub fn new(search_settings: Option<SearchSettings>) -> Self {
|
||||
Engine {
|
||||
game: Game::new(),
|
||||
search_settings: search_settings.unwrap_or(SearchSettings::default()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn go(&mut self) {}
|
||||
}
|
||||
Reference in New Issue
Block a user