Computer Chess Club Archives


Search

Terms

Messages

Subject: Multiple Kogge-Stone-Fills

Author: Gerd Isenberg

Date: 03:01:01 08/24/04


Hi all,

only a vague idea about the possible use of Kogge-Stone-Fill Algorithms...

See Steffan Westcott's original routines:
http://chessprogramming.org/cccsearch/ccc.php?art_id=261956

The idea is to use multiple bitwise combined generators but only one propagator
(empty squares) per direction. So with four generators one may get up to 2**4 ==
16 target sets.

Consider this compact 256-bit board representation with four bitboards and
therefore four bits per square:

g0,g1,g2,gB

Three corresponding bits in the three bitboards g0-g2 determine piece if any,
e.g. in this way (g0 == sliding piece):

gb g2 g1 g0
   0  0  0  empty square
   0  0  1  not used or redundant single rook, see below
   0  1  0  pawn
   0  1  1  bishop
   1  0  0  knight
   1  0  1  rook
   1  1  0  king
   1  1  1  queen

pB determines black pieces.

allPieces =  g0 |  g1 |  g2;
white     =  allPieces& ~gb;

pawns     = ~g0 &  g1 & ~g2;
bishops   =  g0 &  g1 & ~g2;
knights   = ~g0 & ~g1 &  g2;
rooks     =  g0 & ~g1 &  g2;
kings     = ~g0 &  g1 &  g2;
queens    =  g0 &  g1 &  g2;

Now if you do eight (for each queen direction) Kogge-Stone-Fills with these four
bitboards as generators (or two 128-bit XMM words), you have all possible
sliding attacks from all pieces as if they are queens.

The resulting vector of 8*4 = 32 bitboards provides all attack information
needed for move generation and eval, e.g. all pinned piece detected, remove
checkers, checking target squares for bishops or rooks, target squares for
attacking rooks or knights by bishop etc ...

Since Kogge-Stone fill works setwise, one may have some problems to associate
one member of a target directionwise attack set to the piece (rook/bishop/queen)
attacking this square in this particular direction. More than one queen or
light/dark colored bishop per side is uncommon and good predictable by some
conditional jumps, but with rooks that is quite common.

Therefore the idea to isolate the least significant rook per side before doing
the fill cycles and to get disjoint target sets per rook. Additional effort to
map source from target squares is only necessary if more than two rooks per side
are involved.

Cheers,
Gerd




This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.