aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-31 19:47:48 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-31 19:47:48 +0300
commitd5fab95dc19ac46a6400bac657ca7fa57714b27d (patch)
tree0b6c3e0c9904c4d086ca334d7ea02c4db74e15f1
parentef1f7eb8959b788e7b3fec4a01c86eb8cf1e7b04 (diff)
downloadchessnost-d5fab95dc19ac46a6400bac657ca7fa57714b27d.tar.gz
feat: return pondering
-rw-r--r--src/main.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 53a72ea..b5ebc95 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,7 +1,7 @@
use std::{f32::INFINITY, time::{Duration, Instant}};
use std::env;
-use chessnost::board::{Board, Color};
+use chessnost::{board::{Board, Color}, moves::Move};
fn opponent_move(board: &mut Board) {
let mov = match board.read_move() {
@@ -37,6 +37,17 @@ fn computer_move(board: &mut Board, time_left: &mut Duration) {
println!("{:?}", mov);
board.make_move(mov);
board.print();
+
+ // Ponder for some time
+ println!("Assuming 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.unmake_move(pv[1], captured_piece, ep_target_before, castling_rights_before, hash_before);
+
+ board.print();
}
fn main() {