Explanation
A bitboard represents a set of chessboard squares with a 64-bit number. A bit is a unit that can hold only 0 or 1. Because a chessboard has 64 squares, one bit can be assigned to every square.
A value of 1 does not always mean that a piece is present. It means that the square belongs to the set described by that bitboard. A bitboard might mark all White pawns, every square attacked by a knight, all occupied squares, or any other useful group.
A usually maintains several bitboards at once. Bitwise operations, which combine the zeros and ones directly, can intersect sets, unite them, remove squares, or shift patterns with very few processor instructions. This supports fast move and attack generation.
What one bitboard does not store by itself
- Every piece type, unless other bitboards provide that separation.
- Which side is to move.
- rights, meaning whether the special king-and-rook move is still allowed, and en passant availability, meaning whether a pawn can make that special capture.
A complete position combines those facts with several sets. A bitboard is also not a search method such as ; it is a representation of information.
Common confusions
A bitboard and the complete board state
A bitboard normally describes one set of squares. A complete position combines several sets with other state information.
Bitboard and bitbase
A bitboard represents squares in one position; a bitbase stores results for many endgame positions.
View termSources
- 1.Bitboards, Chess Programming Wiki
- 2.bitboard.h, Stockfish
