Module bitboard

Module bitboard 

Source
Expand description

A general purpose way to efficiently encode data, where each bit index of a 64-bit unsigned integer represents a chessboard square.

Data Order:

  • Little-Endian Rank-File mapping (LSR)
  • A1 = least significant bit = 0b0 = 0
  • B1 = 0b1 = 1
  • C1 = 0b10 = 2
  • A2 = 0b1000 = 8
  • H8 = most significant bit = 0x8000000000000000

Compass Rose Bit Shifting:

NoWe       North       NoEa
     +7     +8      +9
West -1      0      +1 East
     -9     -8      -7
SoWe       South       SoEa

Examples of data that may be represented with Bitboards:

  • W/B King position
  • W/B Queen positions
  • W/B Rook positions
  • W/B Bishop positions
  • W/B Knight positions
  • W/B Pawn positions
  • Pawn Attack Pattern per square
  • Knight Attack Pattern per square
  • King Attack Pattern per square
  • Sliding Attack Pattern per square
  • Pass Pawns

Structs§

Bitboard
Bitboard is a wrapper around a u64 integer, where each bit represents some or none on its corresponding chess board square. It is used to encode a set of some arbitrary homogenous data for an entire chess board.
BitboardSquareIterator
Iterator type that yields each square in a bitboard through efficient generation.

Type Aliases§

BitboardKind
Alias for inner type of Bitboard. Useful for const evaluation.