aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authoreug-vs <eugene@eug-vs.xyz>2023-01-26 21:55:53 +0300
committereug-vs <eugene@eug-vs.xyz>2023-01-26 21:55:53 +0300
commitd0840175c37d0e1041e279bd85b4106015bfd5e4 (patch)
treefda1cf61690abbcef47184e0c7871e2698750e62 /src
parent7e9fb647616178391bedc677e488bb2b1ea54786 (diff)
downloadchessnost-d0840175c37d0e1041e279bd85b4106015bfd5e4.tar.gz
fix: correctly update occupancy in en passant
Diffstat (limited to 'src')
-rw-r--r--src/board/mod.rs4
1 files changed, 3 insertions, 1 deletions
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)
},