aboutsummaryrefslogtreecommitdiff
path: root/benches/negamax.rs
blob: b9e38df8107d67d74b00fc24296d014629781888 (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, f32::INFINITY};
use chessnost::board::Board;

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

    let depth = 4;
    let start = Instant::now();
    let (eval, pv) = board.negamax_search(-INFINITY, INFINITY, depth);
    println!("Negamax search (depth = {}) finished in {:?}: {:?}", depth, start.elapsed(), eval);
    board.print();
    for mov in pv {
        println!("{:?}", mov);
        board.make_move(mov);
        board.print();
        println!("Eval for {:?}: {}", board.color(), board.material_advantage());
    }
}