Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Help on bitboards

Author: Toni

Date: 04:19:33 12/25/03

Go up one level in this thread


On December 24, 2003 at 22:25:58, Uri Blass 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.
>>
>>In the literature and in some engines other bitboards are used. For example,
>>beowulf uses:
>>
>>h1 ... a1
>>.      .
>>.      .
>>.      .
>>h8 ... a8
>>
>>Is there a reason for that?
>>
>>Regards
>>
>>Toni
>
>Is there a special reason that you prefer to see h1 as bit0?
>

Well, I feel comfortable reading in that way, updown /rightleft, as I read text.
My show_bitboard routine prints them in that way, i.e.

63 ..... 56
.         .
.         .
.         .
7 ....... 0

My question was mainly about performance issues. I was thinking about the
convenience of having the bits of each column or file consecutively aligned,
things like that.

Thank you all for your responses

Toni

>I translate squares to numbers in my program and a1->0 b1->1 h8->63 seems the
>more natural choice for me.
>
>The reason is simple
>
>1)a1 has the smallest rank and the smallest file so it should be translated to
>the smallest number.
>2)h8 has the biggest rank and the biggest file so it should be translated to the
>biggers number.
>
>3)1<2 suggest intuitively that x1<y2 so I need b1<a2
>You can claim that a<b suggest a2<b1 but I naturally think first about
>comparison between numbers and not comparison between letters.
>
>b1<a2 leave no choice except b1->1 when I translate the squares to 0..63
>
>Uri



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.