A bitboard is a data structure primarily used for representing chess boards. It could be called a specialized bit array (an array of bits), where every bit represents one square in the board. Instead of representing the whole board in one variable, every chess piece has its own bitboard, where the piece will be a set bit (1) and an empty square will be a 0.

Bitboards take advantage of the fact that **a chess board consists of 64 squares and 64 bit numbers can be easily handled by a computer. A 64 bit number looks like this :**

**0**00000000000000000000000000000000000000000000000000000000000000**0**

Where the left most bit is the MSB (Most significant bit) and the right most bit is the LSB (Least significant bit). To make stuff easier, this number can also be written as:

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

You must have noticed that this bitboard is **empty**, since all its bits are set to 0. Since a piece is represented by a 1. Here’s how a bitboard representing the initial position of a white pawn will look like:

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 **1**

0 0 0 0 0 0 0 0

Which in binary, would be 0000000000000000000000000000000000000000000000000000000**1**00000000 or the number 256. (It can also be written as 100 in the hexadecimal system)

Similarly, a white king will be represented by

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 0 0 0 0

0 0 0 0 **1** 0 0 0

Which would be the number 8.

Now since you know how to roll which bitboards, it should be pretty easy to create bitboards for every chess piece. Since that takes a fair amount of time, that’s enough for today!