Page 1 of 1

Quad-bitboards

PostPosted: 12 Nov 2006, 14:44
by Pradu
Hi Gerd!

I've heard you mention quad-bitboards in some of your posts on bitboard fills but I'm not exactly sure what they are. Can you (or anyone else) explain what they are and how they can be used in a chess-program?

Regards,
Pradu

Re: Quad-bitboards

PostPosted: 12 Nov 2006, 16:08
by Gerd Isenberg
Pradu wrote:Hi Gerd!

I've heard you mention quad-bitboards in some of your posts on bitboard fills but I'm not exactly sure what they are. Can you (or anyone else) explain what they are and how they can be used in a chess-program?

Regards,
Pradu


Hi Pradu,

a quad-bitboard is simply a dense board-structure, where arbitrary piece-code-nibbles reside vertically in four bitboards. Together with hashkeys (normal and pawnhash), ep and castle states, movecount, reversable movecount, and some more the whole board structure takes 64-bytes - and make/unmake is almost one simdwise "xor/add/and" instruction with delta[moveNr] on that board-structure.

Quad-bitboards with up to 15 arbitrary codes may be used in fill-algorithms, to generate the multiplexed quad-bitboard in one run with one common empty square propagator. But multiplexing and demultiplexing makes it rather hard to use efficiently.

One simpler coding scheme, where each bitboard is a disjoint set, is following:

Code: Select all
bb0: white rooks or queens
bb1: white king
bb2: black king
bb3: black rooks or queens

Now we can fill this quad-bitboard left and right wise (and for the other directions as well). We can aggregate the real sliding attacks for the taboo sets of the opponent king. We can do simdwise leftFill(bb1:bb0) & rightFill(bb3:bb2) and rightFill(bb1:bb0) & leftFill(bb3:bb2) to get inbetween sets of sliders with opponent king. In case of a sliding check (no piece inbetween) we can use this set as possible target set of check-breaking moves. Otherwise we can intersect it with own pieces to get pinned pieces (in total and by direction) or with opposite pieces to get discovered checkers...

Gerd