Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Simple questions about bitboards

Author: Russell Reagan

Date: 23:39:35 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?
>
>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?

There is no standard way that says which bits represent which squares. I think
the most popular is a1 = 0, b1 = 1, c1 = 2, ..., a2 = 8, ..., h8 = 63. But I've
seen it just about every way possible.

I guess each way has some tiny, microscopic advantage to different people. For
example, think of a bitboard, and how a left shift would change the bits. If you
use the approach I described above, a left shifts moves the bits to the right,
which can get confusing if you're not careful :)

Example:

01000000
01000000
01000000
01000000
01000000
01000000
01000000
01000000

If you take that bitboard and do a "left shift" on it, you get this:

00100000
00100000
00100000
00100000
00100000
00100000
00100000
00100000

When I started doing bitboards, it made the most sense to me to use the approach
I described above, because that is what I did in my 8x8 board representation.

Just do whatever makes the most sense to you when you think about a bitboard and
doing bitwise operations on it in your head.



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.