From d0840175c37d0e1041e279bd85b4106015bfd5e4 Mon Sep 17 00:00:00 2001 From: eug-vs Date: Thu, 26 Jan 2023 21:55:53 +0300 Subject: fix: correctly update occupancy in en passant --- src/board/mod.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/board') diff --git a/src/board/mod.rs b/src/board/mod.rs index c889257..a5803ac 100644 --- a/src/board/mod.rs +++ b/src/board/mod.rs @@ -536,7 +536,9 @@ impl Board { let captured_square = Square::from_coords(mov.source.rank(), mov.target.file()); captured_piece = match self.piece_by_square(captured_square) { Some(pawn_type) => { - self.pieces[pawn_type as usize] ^= captured_square.to_bitboard(); + let captured_bb = captured_square.to_bitboard(); + self.pieces[pawn_type as usize] ^= captured_bb; + self.occupancy ^= captured_bb; self.hash ^= self.zobrist_seed[pawn_type as usize* 64 + captured_square as usize]; Some(pawn_type) }, -- cgit v1.2.3