Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Question about bitboards

Author: Normand M. Blais

Date: 09:30:52 05/24/02

Go up one level in this thread


On May 24, 2002 at 06:28:39, Vladimir Medvedev wrote:

>Where can I find the good explanation of bitboards-based move generators?
>Any link to an *english* (not Ñ or C++ !) text, please?

Hi,

I'm looking into bitboard myself and I came up with way to help me understand.
This is what I have so far after studying crafty.

----------------------------------------------------------------

<BITBOARD MAPPING> - crafty


bytes: 77777777 66666666 55555555 44444444 33333333 22222222 11111111 00000000

 bits: 66665555 55555544 44444444 33333333 33222222 22221111 11111100 00000000
       32109876 54321098 76543210 98765432 10987654 32109876 54321098 76543210

bitbd: 11111111 11111111 00000000 00000000 00000000 00000000 11111111 11111111

Files: HGFEDCBA HGFEDCBA HGFEDCBA HGFEDCBA HGFEDCBA HGFEDCBA HGFEDCBA HGFEDCBA
ranks: 88888888 77777777 66666666 55555555 44444444 33333333 22222222 11111111

  idx: 66665555 55555544 44444444 33333333 33222222 22221111 11111100 00000000
       32109876 54321098 76543210 98765432 10987654 32109876 54321098 76543210


- indexes/bits in relation to ranks and files -
              files
      A  B  C  D  E  F  G  H
  1 |00|01|02|03|04|05|06|07|
r 2 |08|09|10|11|12|13|14|15|
a 3 |16|17|18|19|20|21|22|23|
n 4 |24|25|26|27|28|29|30|31|
k 5 |32|33|34|35|36|37|38|39|
s 6 |40|41|42|43|44|45|46|47|
  7 |48|49|50|51|52|53|54|55|
  8 |56|57|58|59|60|61|62|63|


- squares in relation to bits (in a byte) and bytes -
              bits
     00 01 02 03 04 05 06 07
  0 |A1|B1|C1|D1|E1|F1|G1|H1|
b 1 |A2|B2|C2|D2|E2|F2|G2|H2|
y 2 |A3|B3|C3|D3|E3|F3|G3|H3|
t 3 |A4|B4|C4|D4|E4|F4|G4|H4|
e 4 |A5|B5|C5|D5|E5|F5|G5|H5|
s 5 |A6|B6|C6|D6|E6|F6|G6|H6|
  6 |A7|B7|C7|D7|E7|F7|G7|H7|
  7 |A8|B8|C8|D8|E8|F8|G8|H8|


Relations:

bits = (bytes * 8) + bit_no_in_a_byte
(ex.: E4 = (byte=4, bit=4) => (4*8)+4 = 32+4 = 36)

byte = idx/8 (ex.: 36/8 = 4)
bits = idx % 8 (ex.: 36%8 = 4)

idx = Bits

ranks = 8 - bytes

(files,bytes) = (A,0)(B,1)(C,2)(D,3)(E,4)(F,5)(G,6)(H,7)

----------------------------------------------------------------------

I hope this help a "bit".

Regards,

NMB






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.