aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--benches/negamax.rs21
-rw-r--r--benches/search.rs20
-rw-r--r--src/main.rs1
4 files changed, 21 insertions, 23 deletions
diff --git a/Cargo.toml b/Cargo.toml
index f8eb87c..62a6499 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,5 +14,5 @@ name = "perft"
harness = false
[[bench]]
-name = "negamax"
+name = "search"
harness = false
diff --git a/benches/negamax.rs b/benches/negamax.rs
deleted file mode 100644
index 0c952d6..0000000
--- a/benches/negamax.rs
+++ /dev/null
@@ -1,21 +0,0 @@
-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 (score, pv) = board.negamax_search(-INFINITY, INFINITY, depth);
- println!("Negamax search (depth = {}) finished in {:?}: {:?}", depth, start.elapsed(), score);
- board.print();
- for mov in pv {
- println!("{:?}", mov);
- println!("Score for {:?}: {}", board.color(), board.evaluate(None));
- board.make_move(mov);
- board.print();
- }
- println!("Score for {:?}: {}", board.color(), board.evaluate(None));
-}
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));
+}
diff --git a/src/main.rs b/src/main.rs
index 6a374b7..7931c63 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,7 +5,6 @@ use chessnost::board::Board;
fn main() {
let mut board = Board::new();
-
board.print();
loop {
let mov = match board.read_move() {