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

source

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.

source

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.

source

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.

source

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.

source

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.

source

pub fn generate_rook_magic_number(&self, square: usize) -> u64

Generates a rook magic number for the square specified by square.

source

pub fn generate_bishop_magic_number(&self, square: usize) -> u64

Generates a bishop magic number for the square specified by square.

source

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.

source

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.

source

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.

source

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.

source

fn get_permutation(&self, mask: u64, index: u64) -> u64

Gets index-th permutation of the mask.

source

fn get_rook_mask(&self, square: usize, patterns: &PatternsContainer) -> u64

Gets a rook mask for the square specified by square, without considering occupancy.

source

fn get_bishop_mask(&self, square: usize, patterns: &PatternsContainer) -> u64

Gets a bishop mask for the square specified by square, without considering occupancy.

source

fn get_rook_attacks(&self, occupancy_bb: u64, square: usize) -> u64

Gets a rook attacks for the square specified by square, considering occupancy_bb.

source

fn get_bishop_attacks(&self, occupancy_bb: u64, square: usize) -> u64

Gets a bishop attacks for the square specified by square, occupancy occupancy_bb.

source

fn get_attacks( &self, occupancy_bb: u64, square: usize, direction: (isize, isize) ) -> u64

Helper function to get all possible to move squares, considering occupancy_bb, starting from the square specified by square and going into the direction.

Trait Implementations§

source§

impl Default for MagicContainer

source§

fn default() -> Self

Constructs a new instance of MagicContainer with default values.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.