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

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

    let start = Instant::now();
    let (score, pv) = gm.iterative_deepening(8);

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