Author: Sune Fischer
Date: 13:24:27 03/03/03
Go up one level in this thread
On March 03, 2003 at 15:27:20, Andreas Guettinger wrote: >Thanks Russel, but that was not the problem I want to solve. I already have an >array similar to board[] that contains the locations of my pieces in the >piecelist. >Until now I just maintain a list which is not sorted. When a capture occurs, I >just swap the captured piece with the last piece and do figures--; in undomove() >I just add the piece at the last position and do figures++. Because of this, my >piecelist ist not sorted in the searchtree. But a sorted list would make SEE >more easy, because I can start with the figure at the end of the list (lowest >values) and don't have to sort the attacking/defending pieces. >Danns idea would allow to maintain the piecelist sorted by value. What I don't >like about that idea that I would have to rewrite domove() genmove() etc. :-)) > >regards >Andy I use something like unsigned int indices[6]; unsigned int color[2]; 16 bits for white, 16 bits for black in each dword. Very effective for piece list, you only need to access it when adding or removing a piece, and it allows you to do some cool tricks, ie. looping the rooks and queens: bb = color[WHITE]&(indices[ROOK]|indices[QUEEN]); while (bb) .... only downside is that you need bitscan forward to extract bits, but updating the thing is fast. If you decide to use bitboards you don't need the list at all but you would need to update it a bit more when pieces changes square. -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.