aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/main.rs b/src/main.rs
index b5ebc95..ca3fde2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,7 +1,7 @@
-use std::{f32::INFINITY, time::{Duration, Instant}};
+use std::time::{Duration, Instant};
use std::env;
-use chessnost::{board::{Board, Color}, moves::Move};
+use chessnost::board::{Board, Color};
fn opponent_move(board: &mut Board) {
let mov = match board.read_move() {
@@ -18,11 +18,11 @@ fn opponent_move(board: &mut Board) {
fn computer_move(board: &mut Board, time_left: &mut Duration) {
let allowed_move_duration = *time_left / 20;
- let max_depth = 6 + (board.ply as i32 / 15) as u8;
+ let max_depth = 7 + (board.ply as i32 / 15) as u8;
println!("~{:?} left, allocating {:?} for a move", time_left, allowed_move_duration);
let move_start = Instant::now();
- let (score, pv) = board.iterative_deepening(max_depth, allowed_move_duration);
+ let (score, pv) = board.iterative_deepening(max_depth, allowed_move_duration, true);
let elapsed = move_start.elapsed();
if *time_left >= elapsed {
@@ -39,15 +39,13 @@ fn computer_move(board: &mut Board, time_left: &mut Duration) {
board.print();
// Ponder for some time
- println!("Assuming opponent move from PV: {:?}", pv[1]);
+ println!("Pondering, assume opponent move from PV: {:?}", pv[1]);
let ep_target_before = board.ep_target.clone();
let castling_rights_before = board.castling_rights.clone();
let hash_before = board.hash.clone();
let captured_piece = board.make_move(pv[1]);
- board.iterative_deepening(max_depth, Duration::from_secs(3));
+ board.iterative_deepening(max_depth, Duration::from_secs(3), false);
board.unmake_move(pv[1], captured_piece, ep_target_before, castling_rights_before, hash_before);
-
- board.print();
}
fn main() {