Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Multiple Kogge-Stone-Fills

Author: Tony Werten

Date: 04:06:14 08/24/04

Go up one level in this thread


On August 24, 2004 at 06:01:01, Gerd Isenberg wrote:

>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 ...

Hmm, aren't there easier things for doing this ?

checking squares:

BishopCheckingSquare=bishop_attacks(bishopsq) & bishop_attacks(kingsq)
( you can use for kingsq whatever piecesquare you want )

pieces pinned by bishop:

direct_attacks_squares=bishop_attacks(sq,all_pieces)

less_pieces=all_pieces & ~(direct_attacks_squares);
indirect_attacks_squares=bishop_attacks(sq,less_pieces)
                         & ~(direct_attacks_squares)

pinned_pieces=indirect_attacks_squares
              & less_pieces & ~(own_pieces)


Tony


>
>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.