aboutsummaryrefslogtreecommitdiff
path: root/benches/search.rs
blob: 797638ebc77024b67923bc2f948ec841948d7fdb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use std::{time::{Instant, Duration}, f32::INFINITY};
use chessnost::board::Board;

fn main() {
    let fen = String::from("r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - ");
    let mut board = Board::from_FEN(fen);

    let start = Instant::now();
    let (score, pv) = board.iterative_deepening(6, Duration::from_secs(15), true);

    println!("Finished in {:?}: score={:?} {:?}", start.elapsed(), score, pv);
    board.print();
    for mov in pv {
        println!("Score for {:?} is now: {}", board.color(), board.quiscence(-INFINITY, INFINITY));
        println!("{:?}", mov);
        board.make_move(mov);
        board.print();
    }
    println!("Score for {:?} is now: {}", board.color(), board.quiscence(-INFINITY, INFINITY));
}