aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
blob: 61f2cd35311220af7e2cb56882a47c620a62b5d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use std::{f32::INFINITY, time::{Duration, Instant}};

use chessnost::board::Board;

fn main() {
    let mut board = Board::new();

    board.print();
    loop {
        let mov = match board.read_move() {
            Ok(m) => m,
            Err(e) => {
                println!("Error: {}", e);
                continue;
            }
        };
        print!("{:?}", mov);
        board.make_move(mov);
        board.print();

        let start = Instant::now();
        let (score, pv) = board.iterative_deepening(10, Duration::from_secs(7));
        println!("Finished in {:?}: score={:?}", start.elapsed(), score);

        let mov = pv[0];
        println!("{:?}", mov);
        board.make_move(mov);
        board.print();
        println!("Score for {:?} is now: {}", board.color(), board.quiscence(-INFINITY, INFINITY));

        println!("\nPondering for 3 seconds...");
        board.iterative_deepening(5, Duration::from_secs(3));
    }
}