[][src]Module rustenginelib::square

Structs

MagicInfo

Enums

Delta

Delta enum lists the possible deltas of chess pieces

Constants

BISHOP_DELTAS

BISHOP_DELTAS lists the possible deltas of a bishop

BISHOP_MAGICS
BOARD_AREA

BOARD_AREA tells the size of the board in squares

EMPTY_ATTACK_TABLE

EMPTY_ATTACK_TABLE defines an empty attack table, useful for initializing attack tables

FILE_A

FILE_A represents file 'a' of a chess board

FILE_B

FILE_B represents file 'b' of a chess board

FILE_C

FILE_C represents file 'c' of a chess board

FILE_D

FILE_D represents file 'd' of a chess board

FILE_E

FILE_E represents file 'e' of a chess board

FILE_F

FILE_F represents file 'f' of a chess board

FILE_G

FILE_G represents file 'g' of a chess board

FILE_H

FILE_H represents file 'h' of a chess board

FILE_MASK

FILE_MASK is a mask that has bits set that represent the file within a square

FILE_NAMES

FILE_NAMES maps a file to a file name

KNIGHT_DELTAS

KNIGHT_DELTAS lists the possible deltas of a knight

LAST_FILE

LAST_FILE tells the last file of a chess board

LAST_RANK

LAST_RANK tells the last rank of a chess board

NUM_FILES

NUM_RANKS tells the number of files of a chess board

NUM_RANKS

NUM_RANKS tells the number of ranks of a chess board

ONE_BEFORE_LAST_FILE

ONE_BEFORE_LAST_FILE tells the file before last file

ONE_BEFORE_LAST_RANK

ONE_BEFORE_LAST_RANK tells the rank before last rank

QUEEN_DELTAS

QUEEN_DELTAS lists the possible deltas of a queen

RANK_1

RANK_1 represents rank '1' of a chess board

RANK_2

RANK_2 represents rank '2' of a chess board

RANK_3

RANK_3 represents rank '3' of a chess board

RANK_4

RANK_4 represents rank '4' of a chess board

RANK_5

RANK_5 represents rank '5' of a chess board

RANK_6

RANK_6 represents rank '6' of a chess board

RANK_7

RANK_7 represents rank '7' of a chess board

RANK_8

RANK_8 represents rank '8' of a chess board

RANK_SHIFT

RANK_SHIFT tells the position of the rank in bits within a square

ROOK_DELTAS

ROOK_DELTAS lists the possible deltas of a rook

ROOK_MAGICS
SQUARE_A1

SQUARE_A1 represents square 'a1' of a chess board

SQUARE_A2

SQUARE_A2 represents square 'a2' of a chess board

SQUARE_A3

SQUARE_A3 represents square 'a3' of a chess board

SQUARE_A4

SQUARE_A4 represents square 'a4' of a chess board

SQUARE_A5

SQUARE_A5 represents square 'a5' of a chess board

SQUARE_A6

SQUARE_A6 represents square 'a6' of a chess board

SQUARE_A7

SQUARE_A7 represents square 'a7' of a chess board

SQUARE_A8

SQUARE_A8 represents square 'a8' of a chess board

SQUARE_B1

SQUARE_B1 represents square 'b1' of a chess board

SQUARE_B2

SQUARE_B2 represents square 'b2' of a chess board

SQUARE_B3

SQUARE_B3 represents square 'b3' of a chess board

SQUARE_B4

SQUARE_B4 represents square 'b4' of a chess board

SQUARE_B5

SQUARE_B5 represents square 'b5' of a chess board

SQUARE_B6

SQUARE_B6 represents square 'b6' of a chess board

SQUARE_B7

SQUARE_B7 represents square 'b7' of a chess board

SQUARE_B8

SQUARE_B8 represents square 'b8' of a chess board

SQUARE_C1

SQUARE_C1 represents square 'c1' of a chess board

SQUARE_C2

SQUARE_C2 represents square 'c2' of a chess board

SQUARE_C3

SQUARE_C3 represents square 'c3' of a chess board

SQUARE_C4

SQUARE_C4 represents square 'c4' of a chess board

SQUARE_C5

SQUARE_C5 represents square 'c5' of a chess board

SQUARE_C6

SQUARE_C6 represents square 'c6' of a chess board

SQUARE_C7

SQUARE_C7 represents square 'c7' of a chess board

SQUARE_C8

SQUARE_C8 represents square 'c8' of a chess board

SQUARE_D1

SQUARE_D1 represents square 'd1' of a chess board

SQUARE_D2

SQUARE_D2 represents square 'd2' of a chess board

SQUARE_D3

SQUARE_D3 represents square 'd3' of a chess board

SQUARE_D4

SQUARE_D4 represents square 'd4' of a chess board

SQUARE_D5

SQUARE_D5 represents square 'd5' of a chess board

SQUARE_D6

SQUARE_D6 represents square 'd6' of a chess board

SQUARE_D7

SQUARE_D7 represents square 'd7' of a chess board

SQUARE_D8

SQUARE_D8 represents square 'd8' of a chess board

SQUARE_E1

SQUARE_E1 represents square 'e1' of a chess board

SQUARE_E2

SQUARE_E2 represents square 'e2' of a chess board

SQUARE_E3

SQUARE_E3 represents square 'e3' of a chess board

SQUARE_E4

SQUARE_E4 represents square 'e4' of a chess board

SQUARE_E5

SQUARE_E5 represents square 'e5' of a chess board

SQUARE_E6

SQUARE_E6 represents square 'e6' of a chess board

SQUARE_E7

SQUARE_E7 represents square 'e7' of a chess board

SQUARE_E8

SQUARE_E8 represents square 'e8' of a chess board

SQUARE_F1

SQUARE_F1 represents square 'f1' of a chess board

SQUARE_F2

SQUARE_F2 represents square 'f2' of a chess board

SQUARE_F3

SQUARE_F3 represents square 'f3' of a chess board

SQUARE_F4

SQUARE_F4 represents square 'f4' of a chess board

SQUARE_F5

SQUARE_F5 represents square 'f5' of a chess board

SQUARE_F6

SQUARE_F6 represents square 'f6' of a chess board

SQUARE_F7

SQUARE_F7 represents square 'f7' of a chess board

SQUARE_F8

SQUARE_F8 represents square 'f8' of a chess board

SQUARE_G1

SQUARE_G1 represents square 'g1' of a chess board

SQUARE_G2

SQUARE_G2 represents square 'g2' of a chess board

SQUARE_G3

SQUARE_G3 represents square 'g3' of a chess board

SQUARE_G4

SQUARE_G4 represents square 'g4' of a chess board

SQUARE_G5

SQUARE_G5 represents square 'g5' of a chess board

SQUARE_G6

SQUARE_G6 represents square 'g6' of a chess board

SQUARE_G7

SQUARE_G7 represents square 'g7' of a chess board

SQUARE_G8

SQUARE_G8 represents square 'g8' of a chess board

SQUARE_H1

SQUARE_H1 represents square 'h1' of a chess board

SQUARE_H2

SQUARE_H2 represents square 'h2' of a chess board

SQUARE_H3

SQUARE_H3 represents square 'h3' of a chess board

SQUARE_H4

SQUARE_H4 represents square 'h4' of a chess board

SQUARE_H5

SQUARE_H5 represents square 'h5' of a chess board

SQUARE_H6

SQUARE_H6 represents square 'h6' of a chess board

SQUARE_H7

SQUARE_H7 represents square 'h7' of a chess board

SQUARE_H8

SQUARE_H8 represents square 'h8' of a chess board

TWO_BEFORE_LAST_FILE

TWO_BEFORE_LAST_FILE tells the file two before last file

TWO_BEFORE_LAST_RANK

TWO_BEFORE_LAST_RANK tells the rank two before last rank

Statics

BISHOP_ATTACK

BISHOP_ATTACK is the attack table of bishop

KING_AREA

KING_AREA is the attack table of king plus king square

KING_ATTACK

KING_ATTACK is the attack table of king

KNIGHT_ATTACK

KNIGHT_ATTACK is the attack table of knight

QUEEN_ATTACK

QUEEN_ATTACK is the attack table of queen

ROOK_ATTACK

ROOK_ATTACK is the attack table of rook

Traits

DeltaBuffer

DeltaBuffer trait adds methods to various size buffers that hold deltas

SquareTrait

Square trait adds methods to a Square

Functions

detect_collision

detects collision of a magic applied to a mobility, returns true if there is a collision, false otherwise

find_and_log_magics
find_magic_and_shift

tries to find magic and shift in certain number of tries per shift for a mobility, starting from a maximum shift, going to minimum shift, returns a tuple of the found magic and a bool indicating success

find_magic_for_shift

tries to find magic for shift in certain number of tries for a mobility, returns a tuple of the found magic and a bool indicating success

jump_attack

returns jump attack bitboard from 4 deltas

log_find_magic_and_shift
magic_attack

return magic attack for an attack

mobility_index

returns index of mobility in mobility table for a magic and shift

new_magic

returns a random magic

rank_file

constructs a Square from rank and file

sliding_attack

returns sliding attack bitboard from deltas

total_magic_space
translate_mask_to_occupancy

translates an occupancy mask to partial occupancy of a mobility

Type Definitions

AttackTable

AttackTable type records an attack bitboard for every square of a chess board

File

Rank type represents the file of a square as an unsigned int

Rank

Rank type represents the rank of a square as an unsigned int

Square

Square type represents a square of a chess board as an unsigned int