implemented move generation method or king capture moves

This commit is contained in:
Varga Dávid Lajos
2025-11-20 12:35:46 +01:00
parent 21d26902f0
commit 5b3e84dab0

View File

@@ -32,4 +32,23 @@ impl Board {
}
}
}
fn add_king_captures(&self, buffer: &mut MoveBuffer, move_mask: u64) {
let offset = 6 * self.side_to_move as usize;
let mut kings: u64 = self.bitboards[5 + offset];
let opponents = self.occupancy[1 - self.side_to_move as usize];
while kings != 0 {
let next_sq: u32 = pop_lsb(&mut kings);
let mut attacks: u64 = self.get_pseudo_king_moves(next_sq) & opponents & move_mask;
attacks = self.get_pin_masked_moves(attacks, next_sq);
while attacks != 0 {
let to_sq = pop_lsb(&mut attacks);
buffer.add(BitMove::capture(
next_sq as u8,
to_sq as u8,
None
));
}
}
}
}