Author: Bas Hamstra
Date: 01:38:23 01/22/03
Go up one level in this thread
On January 22, 2003 at 04:22:17, Bas Hamstra wrote: >On January 21, 2003 at 18:57:06, Russell Reagan wrote: > >>On January 21, 2003 at 14:37:10, Bas Hamstra wrote: >> >>>I doubt it too, although the rotated BB lookup tables are relatively big, and >>>may suffer from cache misses, which are expensive. >> >>I wonder how much speed you would gain if you could somehow use smaller tables >>(say a few KB) instead of the amount that Crafty uses, which is around half a >>MB. Significant speedup or not? >> >>>Also I am not sure you >>>couldn't use multiple slider attackmasks for move generation. Suppose you want >>>to generate captures. Generate a combined attackmask UP for all white queens >>>and rooks. AND that mask with all black pieces and you have the TO squares, >>>which will be few (if any). Now you can figure out the FROM squares, by simply >>>scanning the board down from each individual TO square (requires looping), or >>>by taking the attacked-piece mask, and filling it down until it hits white >>>pieces. Or by masking white pieces per file the attacked piece is on, and >>>FirstOne will give the attacker. This would be quite a bit faster than doing >>>the BlockedFill for each piece seperately. Could be competitive, no idea. >> >>Interesting, but I fear that it will either be slow looping or you run into >>complications. For example, if you have a rook on b1 and also on b4, and a >>black bishop on b7, and you used the "AND with file" method you described, >>then you could have problems since both rooks would show up. It's still >>interesting to think about. > >Suppose you loop through the TO squares, popping each bit out with LastOne. Then >the little board-scan down is not slow, I think. Probably about as fast or even >faster than masking the file and doing a FirstOne. Ok let's do your example, >remember we are only talking about UPward attacks for all queens+rooks. > >- b - - - - - - >- - - - - - - - >- - - - - - - - >- - - - - - - - >- R - - - - - - >- - - - - - - - >- - - - - - - - >- R - - - - - - > >combined Attackmask UP for all rooks: > >- 1 - - - - - - >- 1 - - - - - - >- 1- - - - - - >- 1- - - - - - >- - - - - - - - >- 1- - - - - - >- 1- - - - - - >- - - - - - - - > >ANDed with black pieces: > >- 1 - - - - - - >- - - - - - - - >- - - - - - - - >- - - - - - - - >- - - - - - - - >- - - - - - - - >- - - - - - - - >- - - - - - - - > >ToSq = LastOne(ResultBB); >From = FirstOne(OccupiedWhite & FILEMASK[FILE(ToSq)]); > >FirstOne will deliver the right rook here (most significant bit on the file). >You could do the same procedure for DOWN attacks, in that case LastOne would >deliver the right rook. Left/right/diagonals same thing. > >For non-capture generation multiple-piece attack generation seems less usefull >to me. But captures are far more important for performance, because generated >10x as often. So if captures are generated faster and non-captures slower, it >still can be a big win. > >Bas. In fact the last step may require some extra masking in this case: - R - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - b - - - - - - - - - - - - - - - - - - - - - - - R - - - - - - ResultBB - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Now we obviously can't do a FirstOne for white pieces on the file, since that will deliver the wrong rook. But with one extra mask BELOWMASK[Sq] (gives a 1 for each square smaller than Sq) it would work. Bas.
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.