aboutsummaryrefslogtreecommitdiff
path: root/src/board/engine.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/board/engine.rs')
-rw-r--r--src/board/engine.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/board/engine.rs b/src/board/engine.rs
index d00b89b..73c57af 100644
--- a/src/board/engine.rs
+++ b/src/board/engine.rs
@@ -29,6 +29,7 @@ impl Board {
for mov in moves {
let ep_target_before = self.ep_target.clone();
let castling_rights_before = self.castling_rights.clone();
+ let hash_before = self.hash.clone();
let captured_piece = self.make_move(mov);
// King can not be in check after our own move
if !self.is_king_in_check(color) {
@@ -64,7 +65,7 @@ impl Board {
result.en_passants += subtree_result.en_passants;
}
- self.unmake_move(mov, captured_piece, ep_target_before, castling_rights_before);
+ self.unmake_move(mov, captured_piece, ep_target_before, castling_rights_before, hash_before);
}
if print {
@@ -126,12 +127,13 @@ impl Board {
for mov in moves {
let ep_target_before = self.ep_target.clone();
let castling_rights_before = self.castling_rights.clone();
+ let hash_before = self.hash.clone();
let captured_piece = self.make_move(mov);
if !self.is_king_in_check(color) {
let (mut evaluation, mut subtree_pv) = self.negamax_search(-beta, -alpha, depth_left - 1);
evaluation *= -1.;
- self.unmake_move(mov, captured_piece, ep_target_before, castling_rights_before);
+ self.unmake_move(mov, captured_piece, ep_target_before, castling_rights_before, hash_before);
if evaluation >= beta {
return (beta, principal_variation); // Fail-hard beta-cutoff
@@ -143,7 +145,7 @@ impl Board {
principal_variation.append(&mut subtree_pv);
}
} else {
- self.unmake_move(mov, captured_piece, ep_target_before, castling_rights_before);
+ self.unmake_move(mov, captured_piece, ep_target_before, castling_rights_before, hash_before);
}
}
(alpha, principal_variation)
@@ -167,11 +169,12 @@ impl Board {
for mov in tactical_moves {
let ep_target_before = self.ep_target.clone();
let castling_rights_before = self.castling_rights.clone();
+ let hash_before = self.hash.clone();
let captured_piece = self.make_move(*mov);
if !self.is_king_in_check(color) {
let evaluation = -self.quiscence(-beta, -alpha);
- self.unmake_move(*mov, captured_piece, ep_target_before, castling_rights_before);
+ self.unmake_move(*mov, captured_piece, ep_target_before, castling_rights_before, hash_before);
if evaluation >= beta {
return beta; // Fail-hard beta-cutoff
@@ -180,7 +183,7 @@ impl Board {
alpha = evaluation;
}
} else {
- self.unmake_move(*mov, captured_piece, ep_target_before, castling_rights_before);
+ self.unmake_move(*mov, captured_piece, ep_target_before, castling_rights_before, hash_before);
}
}