Struct inanis::state::movegen::MagicContainer
source · pub struct MagicContainer {
pub rook_squares: [MagicSquare; 64],
pub bishop_squares: [MagicSquare; 64],
}
Fields§
§rook_squares: [MagicSquare; 64]
§bishop_squares: [MagicSquare; 64]
Implementations§
source§impl MagicContainer
impl MagicContainer
sourcepub fn get_rook_moves(&self, occupancy_bb: u64, square: usize) -> u64
pub fn get_rook_moves(&self, occupancy_bb: u64, square: usize) -> u64
Gets a rook moves for the square specified by square
, considering occupancy_bb
.
sourcepub fn get_bishop_moves(&self, occupancy_bb: u64, square: usize) -> u64
pub fn get_bishop_moves(&self, occupancy_bb: u64, square: usize) -> u64
Gets a bishop moves for the square specified by square
, considering occupancy_bb
.
sourcepub fn get_queen_moves(&self, occupancy_bb: u64, square: usize) -> u64
pub fn get_queen_moves(&self, occupancy_bb: u64, square: usize) -> u64
Gets a queen moves for the square specified by square
, considering occupancy_bb
.
sourcepub fn get_knight_moves(
&self,
square: usize,
patterns: &PatternsContainer
) -> u64
pub fn get_knight_moves( &self, square: usize, patterns: &PatternsContainer ) -> u64
Gets a knight moves for the square specified by square
, without considering an occupancy.
sourcepub fn get_king_moves(&self, square: usize, patterns: &PatternsContainer) -> u64
pub fn get_king_moves(&self, square: usize, patterns: &PatternsContainer) -> u64
Gets a king moves for the square specified by square
, without considering an occupancy.
sourcepub fn generate_rook_magic_number(&self, square: usize) -> u64
pub fn generate_rook_magic_number(&self, square: usize) -> u64
Generates a rook magic number for the square specified by square
.
sourcepub fn generate_bishop_magic_number(&self, square: usize) -> u64
pub fn generate_bishop_magic_number(&self, square: usize) -> u64
Generates a bishop magic number for the square specified by square
.
sourcefn generate_magic_number(
&self,
shift: u8,
permutations: &[u64],
attacks: &[u64]
) -> u64
fn generate_magic_number( &self, shift: u8, permutations: &[u64], attacks: &[u64] ) -> u64
Generates a magic number for a set of permutations
and attacks
, using shift
proper for the specified square.
sourcefn apply_rook_magic(&mut self, square: usize)
fn apply_rook_magic(&mut self, square: usize)
Applies rook magic for the square specified by square
, using built-in magic number from ROOK_MAGIC_NUMBERS.
sourcefn apply_bishop_magic(&mut self, square: usize)
fn apply_bishop_magic(&mut self, square: usize)
Applies bishop magic for the square specified by square
, using built-in magic number from BISHOP_MAGIC_NUMBERS.
sourcefn apply_magic_for_square(
&self,
permutations: &[u64],
attacks: &[u64],
magic: u64,
shift: u8
) -> Vec<u64>
fn apply_magic_for_square( &self, permutations: &[u64], attacks: &[u64], magic: u64, shift: u8 ) -> Vec<u64>
Applies a magic number for a set of permutations
, attacks
and square
.
sourcefn get_permutation(&self, mask: u64, index: u64) -> u64
fn get_permutation(&self, mask: u64, index: u64) -> u64
Gets index
-th permutation of the mask
.
sourcefn get_rook_mask(&self, square: usize, patterns: &PatternsContainer) -> u64
fn get_rook_mask(&self, square: usize, patterns: &PatternsContainer) -> u64
Gets a rook mask for the square specified by square
, without considering occupancy.
sourcefn get_bishop_mask(&self, square: usize, patterns: &PatternsContainer) -> u64
fn get_bishop_mask(&self, square: usize, patterns: &PatternsContainer) -> u64
Gets a bishop mask for the square specified by square
, without considering occupancy.
sourcefn get_rook_attacks(&self, occupancy_bb: u64, square: usize) -> u64
fn get_rook_attacks(&self, occupancy_bb: u64, square: usize) -> u64
Gets a rook attacks for the square specified by square
, considering occupancy_bb
.
sourcefn get_bishop_attacks(&self, occupancy_bb: u64, square: usize) -> u64
fn get_bishop_attacks(&self, occupancy_bb: u64, square: usize) -> u64
Gets a bishop attacks for the square specified by square
, occupancy occupancy_bb
.
Trait Implementations§
source§impl Default for MagicContainer
impl Default for MagicContainer
source§fn default() -> Self
fn default() -> Self
Constructs a new instance of MagicContainer with default values.