Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Simple questions about bitboards

Author: Robert Hyatt

Date: 19:28:08 09/20/03

Go up one level in this thread


On September 20, 2003 at 22:12:51, Edward Seid wrote:

>Trying to understand a little bit about bitboards.  I have a few questions.
>
>Here is a 64-bit number in binary:
>10000000 00000000 00000000 00000000 ... (32 more zeros)
>What square is represented by the one... a1, a8, h1 or h8?

Up to you.  When you use an array x[i][j] in C, is i the row or
the column?  (answer:  it is whatever you want it to be, just so you
use it consistently in your code).  Ditto for bitboards.

In Crafty, the MSB is a1 (I call that bit 0).  LSB (bit 63) is h8.


>
>Another, 64-bit number:
>(32 zeros) ... 00000000 00000000 00000000 00000001
>Again, what square is represented by the one?
>
>Is there a generally accepted standard way of mapping squares on the chessboard
>to bits in a bit board?

The only real "standard" is that the MSB and LSB will represent "corner"
squares.  Which one is a variable with 4 answers.  :)

>
>VB.NET doesn't have a primitive data type for UInt64.  It does have a Long data
>type, which is Int64.  Is it possible to use Int64 to represent a bitboard, and
>the bitwise operators And, Or, Xor and Not?

No.  Shifts will cause problems.  Right shifts, particularly...

ANDs and ORs will work fine however.

>
>There also aren't any built-in operators for bitshifting, so a user-defined
>function would have to be used.  Do you see any problems in doing bitshifting
>using Int64?  Does the presence of a sign bit cause any problems?

Yes.  A _BIG_ one.


>
>Thanks in advance.



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.