Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: quick bitboard question

Author: Robert Hyatt

Date: 13:58:05 08/26/05

Go up one level in this thread


On August 26, 2005 at 16:45:48, Peter Fendrich wrote:

>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 always used A1=0, B1=2,...,A2=8,...,H8=63.
>I never thought about it as mentally mirrored but maybe my brain is twisted
>somewhere... :-)
>/Peter


In the PC, bit 0 is the rightmost bit.  That's what makes it "mentally mirrored"
since a1 is the leftmost square... :)




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.