Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: quick bitboard question

Author: Robert Hyatt

Date: 12:34:47 08/26/05

Go up one level in this thread


On August 26, 2005 at 15:21:08, Dann Corbit 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.
>
>I am guessing H1=0 is the most popular, because it will line up with FEN and EPD
>strings.  I am doing a survey right now (actually a recursive grep) through the
>thousands of C and C++ code and header files to find out which enumeration is
>really the most popular.

Let me know what you find.

I thought about things like H1=0, H2=12, H3=25, etc.  :)  I can make anything
work, and it would be hard as hell to figure out what I was doing however. :)




>
>>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...



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.