Add magic bitboard generation

This commit is contained in:
Bruno BELANYI 2022-07-22 18:42:05 +02:00
parent 3410ba518e
commit d268db38c1
4 changed files with 75 additions and 3 deletions

View file

@ -14,7 +14,6 @@ pub struct Magic {
impl Magic {
/// Compute the index into the magics database for this set of `blockers`.
#[allow(unused)] // FIXME: remove once used
pub fn get_index(&self, blockers: Bitboard) -> usize {
let relevant_occupancy = (blockers & self.mask).0;
let base_index = ((relevant_occupancy.wrapping_mul(self.magic)) >> self.shift) as usize;