Author: Sune Fischer
Date: 16:41:25 08/23/03
Go up one level in this thread
On August 23, 2003 at 19:33:28, Omid David Tabibi wrote: >On August 23, 2003 at 17:29:11, Sune Fischer wrote: > >>On August 23, 2003 at 17:12:32, Uri Blass wrote: >>> >>>Note that I do not like a piece list of 32 squares because it means that even >>>after having the attack information I cannot get the information if the square >>>is attacked by a rook directly and I need to look at the squares of the >>>attackers to see the type of the piece. >> >>There are max 32 pieces on the board, so you just do >>if (ix_attack_sq[sq] & ix_pc[ROOK]) ... >>that gives you a 32 bit piece list of rooks (black and white) attacking that >>square. >>If you want just white rooks: >>if (ix_attack_sq[sq] & ix_pc[ROOK] & ix_co[WHITE]) .... >>and so on. >> > >Each side can have maximum 16 pieces, initially: > >8 pawns >2 knights >2 bishops >2 rooks >1 queen >1 king > >elegantly fitting in your table. But how do you handle pawn promotions? > >E.g., how do you represent the following pieces in the 16 bits? > >6 pawns >3 knights >2 bishops >2 rook >2 queens >1 king No need to keep them in order, use a quick list: uint32 ix_pc[KING+1]; // index of pieces Then you need two more to keep track of colors (or you can just use upper 16 for one color, however it comes in handy if you want to loop all the pieces). uint32 ix_co[2]; // index of colors ... // many others, such as sliders and non_sliders Really, there is no difference from 64 bitboards, the 32 bits work exactly the same, execpt you don't reference squares but indices. I'm not really sure it is that great an idea, probably it is better to stick to just using bitboards with squares. The index layer is not really needed as far as I can tell. -S.
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.