diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-01-26 19:22:06 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-01-26 19:22:06 +0300 |
commit | ba7d370ffbae459782b5356b4a4364ac94c378f2 (patch) | |
tree | a38ffddca5923bbf02c0bb4bc5344dab47e68432 /src | |
parent | 73db3fa8950d53008467ff5925010e2322e19e77 (diff) | |
download | chessnost-ba7d370ffbae459782b5356b4a4364ac94c378f2.tar.gz |
feat: add main loop
Diffstat (limited to 'src')
-rw-r--r-- | src/main.rs | 18 |
1 files changed, 17 insertions, 1 deletions
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()); + } } |