Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Extracting information from rotated Bitboards

Author: Robert Hyatt

Date: 18:45:05 11/02/98

Go up one level in this thread


On November 02, 1998 at 17:58:06, John Stoneham wrote:

>In my program GrimReaper, I use a simple function consisting of a pre-calculated
>mask value and a pre-calculated shift value (more pertinent to diagonal
>rotations, but still usefull to the 90 degree rotation) to extract the 8-bit
>code necessary for accessing the (again) pre-calculated attacked squares for the
>given rotation (Queen/Rook or Queen/Bishop). Obviously, for unrotated
>orientations, or 90 degree rotations, the masks and shifts are simple. But
>diagonals are more complicated, and the use of an array of precalulated shifts
>and masks for the given orentation seems necessary. Since these are calculated
>before the engine is started, it seems simple to calculate the 90 degree shifts
>and masks as well. Then all you need is a ((Bitboard & mask) << shift) type of
>routine to get the 8-bit has value, regarless of the rotation. (More information
>on my routines is available in my GrimReaper journal at
>www.geocities.com/SiliconValley/Lab/4714/index.html). Does any handle this
>calculation differently?

a couple of tricks...

1.  you can use square&56 as the shift amount for the 90 degree rotated bit map,
since that will get you exactly the right shift count for any rank...

2.  you may use a bishop shift value, but you can get away by always using 8
bits from the rotated diagonal bitmaps, if you simply set up the array so that
the "unused bits" still produce the right answer.  This avoids having a
different mask for each diagonal length...




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.