Home

bitboard

A bitboard is a technique used in board game programming where the state of a board is encoded into binary words. In chess, a standard bitboard uses 64 bits; each bit corresponds to a square on an 8x8 board, typically mapped from a1 to h8. Engines store multiple bitboards, one for each piece type and color (for example, white pawns, black knights), and also occupancy bitboards such as all white pieces, all black pieces, and all pieces overall. A square is marked in a bitboard if that square is occupied by the corresponding piece.

Operations on bitboards rely on bitwise operators. Bitwise AND, OR, XOR and shifts manipulate bitboards to perform

Advantages of bitboards include the ability to process many squares in parallel within a single CPU word,

Extensions and variants include using multiple 64-bit bitboards for boards larger than 64 squares, and employing

move
generation
and
evaluation.
For
example,
shifting
a
pawn
bitboard
can
represent
forward
moves,
while
masks
enforce
move
legality.
Attack
sets
for
knights
and
kings
are
derived
from
fixed
shift
patterns;
sliding
pieces
use
occupancy
masks
and,
in
optimized
forms,
magic
bitboards
to
compute
ray
attacks
efficiently.
leading
to
fast
move
generation,
evaluation,
and
pruning.
They
are
memory-efficient
and
align
well
with
modern
64-bit
processors,
enabling
highly
optimized
engines.
techniques
such
as
magic
bitboards
and
precomputed
lookup
tables
to
accelerate
sliding
moves.
Bitboards
are
also
used
in
other
games
and
hybrid
representations,
but
remain
most
prominent
in
high-performance
chess
engines.