aboutsummaryrefslogtreecommitdiff
path: root/benches/search.rs
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-28 22:46:04 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-28 22:46:04 +0300
commit6c15e34e6bb645a2a4b4e4939d98078cd4b2c74a (patch)
tree23dec84b4e258f4e1d1bf44576299e676a1df1ac /benches/search.rs
parent60c9daa2034ab517d65aac218108c4c87e9f9ec2 (diff)
downloadchessnost-6c15e34e6bb645a2a4b4e4939d98078cd4b2c74a.tar.gz
refactor: rename benches/negamax -> search
Diffstat (limited to 'benches/search.rs')
-rw-r--r--benches/search.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/benches/search.rs b/benches/search.rs
new file mode 100644
index 0000000..41027f9
--- /dev/null
+++ b/benches/search.rs
@@ -0,0 +1,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));
+
+ 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));
+}