Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Attack detection with bitboards: alternative to "rotated bitboards"

Author: Robert Hyatt

Date: 06:47:03 12/05/99

Go up one level in this thread


On December 05, 1999 at 07:09:36, Inmann Werner wrote:

>Thank you Allessandro :-)
>
>Will try to understand it....
>
>Werner


Here is the main 'gist'...  In crafty, I completely rotate the occupied_squares
bitmap three times to give me a 64-bit map of occupied squares with the ranks,
then the files, then each diagonal mapped into adjacent bits...

One 'cost' with doing this is that to generate sliding attacks along a 'ray'
I have to extract just the bits for that ray from the full 64bitt occupied_
squares bitmap using a shift/and operation pair.

The approach given here separates each rank/file/diagonal into a separate
char value.  This makes updating them a little cheaper, and accessing them
a little cheaper, on a 32 bit architecture.  However, these maps are still
rotated, no doubt about that...  they are just kept in a 'pre-digested' format
that prevents accessing the entire 64 bits at one time...

I tested this on a 64 bit architecture and it turned out to be slower, because
the rotated bitmaps for the bishop (my approach) take 64 bits, while the way
given here takes 15 char values of 8 bits each...  And on the 64 bit machine
the entire 64 bits gets updated with no array indexing, which is very efficient,
while this approach requires an array access and _still_ does a 64 bit AND/OR
to update the bitmap.  The array access is slower than the usual operation to
set/clear a bit...

Overall, on 32 bit machines, this was a bit faster, but only a bit.  On 64 bit
architectures it is slower...




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.