Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: To: Gerd

Author: Bas Hamstra

Date: 01:22:17 01/22/03

Go up one level in this thread


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.








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.