I useJoost Buijs wrote: ↑Thu May 13, 2021 5:08 pm20 years ago I switched from mailbox to bit-boards, since that time I use this and never changed it:MartinBryant wrote: ↑Thu May 13, 2021 11:50 am What other designs are there? What do you guys use?
Is there a generally accepted 'best' design?
What other advantages might they offer? (I'm loath to rewrite a load of working/tested code for negligible benefit)
Many thanks in advance for any pearls of wisdom!
It really doesn't matter much how you do it, you can put the bit-boards in an array of 2 structs (one for each color), or only use 1 bit-board for each piece type with an occupied bit-board for each color and mask them. In the end there is hardly any difference in performance.Code: Select all
bb_t bb_occupied[numSides]; bb_t bb_pawns[numSides]; bb_t bb_knights[numSides]; bb_t bb_bishops[numSides]; bb_t bb_rooks[numSides]; bb_t bb_queens[numSides]; bb_t bb_king[numSides]; uint8_t pieces[numSquares];
U64 manhattans;
U64 diagonals;
Instead of
U64 rooks;
U64 bishops;
U64 queens;
Sometimes, I wish I didn’t, but these things tend to get fixed in cement.
U64 rooks = manhattans & not(diagonals);
U64 bishops = diagonals & not(manhattans);
U64 queens = manhattans & diagonals;

