From ba7d370ffbae459782b5356b4a4364ac94c378f2 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 26 Jan 2023 19:22:06 +0300 Subject: feat: add main loop --- src/main.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index e7a11a9..3e8e461 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,19 @@ +use std::{f32::INFINITY, time::{Duration, Instant}}; + +use chessnost::board::Board; + fn main() { - println!("Hello, world!"); + let mut board = Board::new(); + + loop { + let start = Instant::now(); + let (score, pv) = board.iterative_deepening(Duration::from_secs(4)); + println!("Finished in {:?}: score={:?}", start.elapsed(), score); + + let mov = pv[0]; + println!("{:?}", mov); + board.make_move(mov); + board.print(); + println!("Score for {:?} is now: {} (material advantage={})", board.color(), board.quiscence(-INFINITY, INFINITY), board.material_advantage()); + } } -- cgit v1.2.3