diff options
author | eug-vs <eugene@eug-vs.xyz> | 2023-01-24 23:37:57 +0300 |
---|---|---|
committer | eug-vs <eugene@eug-vs.xyz> | 2023-01-24 23:37:57 +0300 |
commit | f5b2d63f2f1131c23d26360c98d7db44d9efb71d (patch) | |
tree | c5affd9ba172aec2f11cfbf43573fc402839f30b /benches/negamax.rs | |
parent | ed12bd22248e78ad28157ededfed2be63e2d5062 (diff) | |
download | chessnost-f5b2d63f2f1131c23d26360c98d7db44d9efb71d.tar.gz |
feat: gather principal variation in negamax
Diffstat (limited to 'benches/negamax.rs')
-rw-r--r-- | benches/negamax.rs | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/benches/negamax.rs b/benches/negamax.rs new file mode 100644 index 0000000..b9e38df --- /dev/null +++ b/benches/negamax.rs @@ -0,0 +1,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()); + } +} |