aboutsummaryrefslogtreecommitdiff
path: root/benches/negamax.rs
diff options
context:
space:
mode:
Diffstat (limited to 'benches/negamax.rs')
-rw-r--r--benches/negamax.rs20
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());
+ }
+}