Expand description
Attack and ray tables.
§Example
use shakmaty::{attacks, Rank, Square, Bitboard};
let occupied = Bitboard::from(Rank::Sixth); // blocking pieces
let attacks = attacks::bishop_attacks(Square::C2, occupied);
// . . . . . . . .
// . . . . . . . .
// 0 0 0 0 0 0 1 0
// . . . . . 1 . .
// 1 . . . 1 . . .
// . 1 . 1 . . . .
// . . . . . . . .
// . 1 . 1 . . . .
assert!(attacks.contains(Square::G6));
assert!(!attacks.contains(Square::H7));
Functions§
- Tests if all three squares are aligned on a rank, file or diagonal.
- Looks up attacks for
piece
onsq
withoccupied
squares. - The squares between the two squares (bounds not included), or an empty
Bitboard
if they are not on the same rank, file or diagonal. - Looks up attacks for a bishop on
sq
withoccupied
squares. - Gets the set of potential blocking squares for a bishop on
sq
. - Looks up attacks for a king on
sq
. - Looks up attacks for a knight on
sq
. - Looks up attacks for a pawn of
color
onsq
. - Looks up attacks for a queen on
sq
withoccupied
squares. - The rank, file or diagonal with the two squares (or an empty
Bitboard
if they are not aligned). - Looks up attacks for a rook on
sq
withoccupied
squares. - Gets the set of potential blocking squares for a rook on
sq
.