Module shakmaty::attacks[][src]

Expand description

Attack and ray tables.

Example

use shakmaty::attacks;

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 on sq with occupied 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 with occupied 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 on sq.

Looks up attacks for a queen on sq with occupied 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 with occupied squares.

Gets the set of potential blocking squares for a rook on sq.