Probe TT at each negamax recursion and store entries based on bounds

This commit is contained in:
stefiosif
2024-10-14 23:57:54 +03:00
parent 33617df497
commit b2df931d48
5 changed files with 135 additions and 68 deletions

View File

@@ -57,10 +57,11 @@ impl Game {
let color = board.state.current_player();
let pawn_move = board.is_pawn_move(mv.src);
let mut en_passant_square = None;
let capture_en_passant = match color {
Color::White => mv.dst - 8,
let ep_capture = match color {
Color::White => mv.dst.saturating_sub(8),
Color::Black => mv.dst + 8,
};
let old_castling_ability = board.state.castling_ability;
let piece_at_src = mailbox
@@ -84,11 +85,11 @@ impl Game {
}
MoveType::EnPassant => {
board.move_piece(mv.src, mv.dst, PieceType::Pawn);
board.remove_opponent_piece(capture_en_passant, PieceType::Pawn);
hash.update_en_passant(mv.src, mv.dst, capture_en_passant, color);
board.remove_opponent_piece(ep_capture, PieceType::Pawn);
hash.update_en_passant(mv.src, mv.dst, ep_capture, color);
hash.drop_en_passant_hash(board.state.en_passant_square());
mailbox.set_piece_at(mv.dst, Some(PieceType::Pawn));
mailbox.set_piece_at(capture_en_passant, None);
mailbox.set_piece_at(ep_capture, None);
}
MoveType::DoublePush => {
board.move_piece(mv.src, mv.dst, piece_at_src);