Struct alcibiades::utils::BoardGeometry [] [src]

pub struct BoardGeometry {
    pub squares_at_line: [[Bitboard; 64]; 64],
    pub squares_between_including: [[Bitboard; 64]; 64],
    pub squares_behind_blocker: [[Bitboard; 64]; 64],
    pub pawn_attacks: [[Bitboard; 64]; 2],
}

Tables and methods useful for move generation and position evaluation.

Fields

Contains bitboards with all squares lying at the line determined by two squares.

Examples:

g.squares_at_line[B2][F6]
. . . . . . . 1
. . . . . . 1 .
. . . . . 1 . .
. . . . 1 . . .
. . . 1 . . . .
. . 1 . . . . .
. 1 . . . . . .
1 . . . . . . .

Contains bitboards with all squares lying between two squares including the two squares themselves.

Examples:

g.squares_between_including[B2][F6]
. . . . . . . .
. . . . . . . .
. . . . . 1 . .
. . . . 1 . . .
. . . 1 . . . .
. . 1 . . . . .
. 1 . . . . . .
. . . . . . . .

Contains bitboards with all squares hidden behind a blocker from attacker's position.

Examples:

g.squares_behind_blocker[B2][F6]
. . . . . . . 1
. . . . . . 1 .
. . . . . B . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. A . . . . . .
. . . . . . . .

Contains bitboards with the squares attacked by a pawn from a given square.

Examples:

g.pawn_attacks[WHITE][F6]
. . . . . . . .
. . . . 1 . 1 .
. . . . . P . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .

g.pawn_attacks[BLACK][H8]
. . . . . . . p
. . . . . . 1 .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .

Methods

impl BoardGeometry
[src]

Returns a reference to an initialized BoardGeometry object.

The object is created only during the first call. All next calls will return a reference to the same object. This is done in a thread-safe manner.

Returns the set of squares that are attacked by a piece from a given square.

This function returns the set of squares that are attacked by a piece of type piece from the square from_square, on a board which is occupied with pieces according to the occupied bitboard. piece must not be PAWN. It does not matter if from_square is occupied or not.

Returns the set of squares that are attacked by a piece from a given square.

This is unsafe version of attacks_from. This version is slightly faster because it does not verify that from_square <= 63. It is caller's responsibility to ensure that.