1

I have studied bitboard but have failed to find an example on what the bitboard coding would look like in c#. If someone would be so kind to illustrate how a checkers board (8x8) would be programmed with a 32-bit.

I know there are 64 squares, but how do you populate only 32 of them and all contained with these 32-bit data structures.

Tennant125
  • 33
  • 4

1 Answers1

0

You basically don't just use single bitboard instead you use multiple bitboards. Different bitboards represent different kind of pieces on board, and this is where the magic of bitboards come into action. Suppose you have a bitboard P that represents white pawns on bitboard, now in order to get the legal moves for every white pawn, you can simply do something like

legalMovesForWhitePawns = (P << 8) & ~(AllWhitePiecegs | AllBlackPieces)

This simple statement will give you all the one step non-capturing moves for white pawns

clemens
  • 16,716
  • 11
  • 50
  • 65