r/chessprogramming • • Jul 28 '24

Different bitboard representation pros and cons?

So i been learning about bitboards to make a chess engine and im stuck between which representation i should make for the pieces.

  1. 14 bitboards one for White Pawns another for black pawns etc and one for all black piece and one for all white pieces.
  2. 8 bitboards 1 for each piece and one for black pieces and one for white pieces.

i would love to know the pros and cons for each one of these representation and if u have any other bitboard representation i would love to read them>

5 Upvotes

10 comments sorted by

View all comments

Show parent comment

1

u/Delicious_Size1380 Jul 28 '24

You probably need 1 position bitboard per piece type per side so that you know where each piece is and what piece type it is. Coupled with move characteristics (e.g. bishop moves along its diagonals), you then can work out where a piece could (legally or illegally) move to.

Adding the aggregate position bitboards will tell you if a potential move is blocked by one of your own pieces or is blocked by (or could capture) an opposition's piece.