Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: quick bitboard question

Author: Gerd Isenberg

Date: 23:47:59 08/26/05

Go up one level in this thread


On August 26, 2005 at 15:04:55, Robert Hyatt wrote:

>I'm fixing to change the way I number bits to make bit 0 the LSB (as the BSF/BSR
>instructions count on the X86) rather than the MSB as the leading zero
>instruction counts on the Cray-1 architecture.
>
>I have four choices for which square bit 0 represents (four logical choices,
>anyway, I guess one could number bits randomly should they choose).
>
>A1 = 0
>H1 = 0
>A8 = 0
>H8 = 0
>
>For those of you using bitboards, which did you use?  Since it doesn't matter to
>me at all, since I am having to rewrite a bunch of stuff to make this work, I
>thought I would try to match the most common layout which will make the programs
>more compatible if we share any ideas.
>
>I am leaning toward H1 = 0, H2 = 8, ..., H8 = 56 and A8 = 63, but I've not made
>any decision yet...  The reason for this is that it is easier to visualize if
>you think of the chess board as being composed of the 1 rank and the rightmost 8
>bits of the bitboard, the 2nd rank is the next 8 bits, etc.
>
>The alternative is H8=0, etc, so that the last rank is the rightmost bits, the
>seventh rank is the next 8 bits, etc.  Anything else requires "mentally
>mirroring" so that if A1 or A8 is bit zero, the bits are backward, since A8 is
>the left end of a rank, and bit 0 is the right end of a set of 8 bits...


I use A1 == 0 with all it's drawbacks with the mirror in my brain.
A1 is the "least significant square", while H8 the "most significant square",
due to lexical order of the square indices, "A1" < "A2" < ... < "H8" ;-)

Gerd



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.