diff options
Diffstat (limited to 'engine/src/main.rs')
| -rw-r--r-- | engine/src/main.rs | 54 |
1 files changed, 37 insertions, 17 deletions
diff --git a/engine/src/main.rs b/engine/src/main.rs index 32e0f62..d4bcc48 100644 --- a/engine/src/main.rs +++ b/engine/src/main.rs @@ -1,7 +1,8 @@ -use std::{num::NonZeroU8, thread::sleep, time::Duration}; +use std::num::NonZeroU8; use engine::{ActualLimit, Engine, EvaluationSettings, Frontend}; use mimalloc::MiMalloc; +use model::CheckersBitBoard; #[global_allocator] static ALLOCATOR: MiMalloc = MiMalloc; @@ -11,28 +12,47 @@ const DEPTH: u8 = 19; struct BasicFrontend; impl Frontend for BasicFrontend { - fn debug(&self, _: &str) {} + fn debug(&self, msg: &str) { + println!("{msg}"); + } fn report_best_move(&self, best_move: model::Move) { println!("{best_move}"); - std::process::exit(0); } } fn main() { 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)) - } + let (_, best) = engine.evaluate( + None, + 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, + }), + }, + ); + engine.set_position(CheckersBitBoard::new( + 4294967295, + 2206409603, + 3005432691, + model::PieceColor::Light, + )); + engine.evaluate( + None, + 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, + }), + }, + ); } |
