Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Help on bitboards

Author: Alessandro Damiani

Date: 01:08:57 12/25/03

Go up one level in this thread


On December 24, 2003 at 22:59:18, Russell Reagan wrote:

>On December 24, 2003 at 21:23:46, Toni wrote:
>
>>Hi all.
>>
>>I'm starting my chess engine and I'm dealing with bitboards. I find natural to
>>code the board as:
>>
>>a8 ... h8
>>.      .
>>.      .
>>.      .
>>a1 ... h1
>>
>>so bit0 = h1 and bit 63= a8, viewing the board from white's point of view.
>
>I have always done it this way that you mention also.
>
>The only point of confusion that I've had is when you do a left shift (<<), the
>bits visually move to the right (and a right shift goes left). So someone might
>choose to arrange the bits in such a way that a left shift moves left, and a
>right shift moves right.
>
>I guess someone also might choose to have a8=0, b8=1, and h1=63, because then
>when you output the board you just go from 0 to 63 and it outputs the squares
>correctly.
>

That's the way I do it.


>I don't think there is any "right" way to do this. Just choose whatever makes
>the most sense to you so that things like rotated bitboards will be easier for
>you to understand.

I never used rotated bitboards, but rotated indices. These are simpler.

Alessandro



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.