Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Resources about rotated bitboards

Author: Gerd Isenberg

Date: 12:51:42 01/16/04

Go up one level in this thread


On January 16, 2004 at 14:26:32, Alessandro Damiani wrote:

>
>>i was asking because i'm generating all attacks in all positions (also the leaf
>>nodes), which takes a significant amount of time. i thought my
>>looping-over-bitboards was terribly slow, then i replaced it by the kogge-stone
>>stuff that was posted here a while ago, and it got even slower ;-)
>>so the next thing to try would be rotated bitboards, but it's rather a lot of
>>work to implement, i'm afraid.
>
>When I started working on my engine years back I first implemented the Chess 4.0
>style attack tables. Then I read about Bob's Rotated Bitboards. I liked the
>idea, but found keeping updated rotated representations of the board too
>complicated. I therefore developed my own way of determining the attacked
>squares. I call it Rotated Indices. As its name suggests it keeps updated the
>indices used to access the attack tables. In contrast to Rotated Bitboards you
>don't have to extract the index out of the rotated bitboards, it is already
>there. The code is very simple.
>
>If you really want to implement Rotated Bitboards then you have to do it,
>waiting doesn't help. ;-) But, if you don't want to spend more than two hours
>for the implementation then you may have a look at Rotated Indices. You can find
>the source code on my homepage under "Chess programming: Bitboards in Fortress":
>http://freeweb.econophone.ch/fortress
>
>Alessandro
>        ....eine Einbuchtung im Raum

After looking a while to your source, i think your code is very similar to mine,
except the data density of your Indices and the identifiers ;-)

// slide indices:
unsigned int SlideIndexH[8],     // horizontal
             SlideIndexV[8],     // vertical
             SlideIndexRU[16],   // right up (RU)
             SlideIndexRD[16];   // right down (RD)

I use(d) something like this:

// slide indices == rotated bitboards:
unsigned char SlideIndexH[8],     // horizontal
              SlideIndexV[8],     // vertical
              SlideIndexRU[8],   // right up (RU)
              SlideIndexRD[8];   // right down (RD)

But with bitboard declaration instead of BYTE[8] (what about a union?).
The only trick is to pack the 15 diagonals byte aligned into eight bytes and
address them in this manner.

rightupIdx   = (sq-Rank(sq)) & 7;
rightDownIdx = (~sq-Rank(sq)) & 7;

My drawback was the byte access with zero extending to 32-bit.
Your drawback is to update four SlideIndices additionally to the none rotated
one and i had only three additional ones.

Gerd



This page took 0.01 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.