diff options
| -rw-r--r-- | engine/src/lib.rs | 6 | ||||
| -rw-r--r-- | engine/src/main.rs | 35 |
2 files changed, 33 insertions, 8 deletions
diff --git a/engine/src/lib.rs b/engine/src/lib.rs index 8139530..27a1f2d 100644 --- a/engine/src/lib.rs +++ b/engine/src/lib.rs @@ -131,9 +131,9 @@ pub enum SearchLimit { #[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] pub struct ActualLimit { - nodes: Option<NonZeroUsize>, - depth: Option<NonZeroU8>, - time: Option<Duration>, + pub nodes: Option<NonZeroUsize>, + pub depth: Option<NonZeroU8>, + pub time: Option<Duration>, } pub trait Frontend: Sync { diff --git a/engine/src/main.rs b/engine/src/main.rs index afc132f..3b41418 100644 --- a/engine/src/main.rs +++ b/engine/src/main.rs @@ -1,13 +1,38 @@ -use engine::{CheckersBitBoard, TranspositionTable}; +use std::{num::NonZeroU8, thread::sleep, time::Duration}; + +use engine::{ActualLimit, Engine, EvaluationSettings, Frontend}; use mimalloc::MiMalloc; #[global_allocator] static ALLOCATOR: MiMalloc = MiMalloc; -const DEPTH: u8 = 18; +const DEPTH: u8 = 19; + +struct BasicFrontend; + +impl Frontend for BasicFrontend { + fn debug(&self, msg: &str) {} + + fn report_best_move(&self, best_move: model::Move) { + println!("{best_move}"); + std::process::exit(0); + } +} fn main() { - //let board = CheckersBitBoard::starting_position(); - //let mut table = TranspositionTable::new(50_000); - //println!("{}", current_evaluation(DEPTH, board, table.get_ref())); + let engine = Box::leak(Box::new(Engine::new(1_000_000, &BasicFrontend))); + engine.start_evaluation(EvaluationSettings { + restrict_moves: None, + ponder: false, + clock: engine::Clock::Unlimited, + search_until: engine::SearchLimit::Limited(ActualLimit { + nodes: None, + depth: Some(NonZeroU8::new(DEPTH).unwrap()), + time: None, + }), + }); + + loop { + sleep(Duration::from_millis(200)) + } } |
