Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Mixing 0x88 and bitboards

Author: Sune Fischer

Date: 01:38:25 06/26/02

Go up one level in this thread


On June 26, 2002 at 02:02:28, Bruce Moreland wrote:

>On June 25, 2002 at 05:26:34, Sune Fischer wrote:
>
>>On June 24, 2002 at 20:33:32, Russell Reagan wrote:
>>
>>>I am not an experienced bitboard user. I've been thinking about trying them out
>>>just to see how they work in comparison with my current 0x88 implementation. Is
>>>there any potential problem in mixing the two approaches? One problem that I can
>>>see would be that if you have an index for a bitboard, it's not going to index
>>>into the same square in your 0x88 array. I suppose the only real reason to keep
>>>0x88 would be for efficient edge detection. Do bitboards offer a solution to
>>>edge detection? Or do they even need edge detection when using bitboards (ex.
>>>using the BSF asm instuction would seem to avoid edge detection altogheter)?
>>>
>>>Thanks,
>>>Russell
>>
>>For edge detection you can do this:
>>
>>if (((uint64)1<<square)&0xFF818181818181FF)
>>  ...
>>
>>it will tell you when you are on the first and last file or rank.
>>I use that in my SEE to raytrace behind the attacking piece, something like
>>
>>while (!(((uint64)1<<square)&0xFF818181818181FF)) {
>>  square+=direction;
>>  if (there-is-an-attacker-on-square)
>>    add-it-to-the-list-of-attackers
>>}
>>
>
>That shift has to be lots of fun for the processor.

That is why I really use a Mask[square] table, but for the sake of clarity... :)
Anyway I changed it to a macro, so now I can quickly test which is faster, and
it seems the Mask[] lookup is faster, for the moment.

-S.

>bruce



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.