Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bit board representation

Author: Robert Hyatt

Date: 17:59:22 05/29/01

Go up one level in this thread


On May 29, 2001 at 20:17:24, Pham Minh Tri wrote:

>On May 29, 2001 at 10:02:10, Robert Hyatt wrote:
>
>>On May 29, 2001 at 03:40:23, Pham Minh Tri wrote:
>>
>>>On May 28, 2001 at 01:40:52, Cheok Yan Cheng wrote:
>>>
>>>>For a game that used 8x8 board like chess, we can use the bit board
>>>>representation by using a 64 bit sized variable. However, for the game that used
>>>>board sized 9x10 like chinese chess, is it possible to use bit board
>>>>representation that need 90 bit sized variable (where can i get a variable sized
>>>>90 bits ??)
>>>>
>>>>thanks
>>>
>>>Chinese chess has not got the "gold number" of 64 like chess, so it is hard to
>>>use bitboard or some other representations than array. If you insist on using
>>>bitboard, I suggest that you could use a "mix" representation (like some chess
>>>programmers did): use bitboard for some pieces (king, pawn, adviser, elephant -
>>>they are suitable for 64 bit bitboard) and array for the others. However, I do
>>>not believe bitboard will bring to Chinese chess programmers any benefit or fun.
>>>
>>>Pham
>>
>>
>>Remember my earlier comment.  Chess 4.x ran on a 60 bit machine, which means
>>every bitboard operation had to be spread across two words of memory.  On the
>>32-bit PC, the bitboard operations are one way to take advantage of the two
>>integer pipes on the PC.  Other machines have more than two integer pipes that
>>are very hard to keep busy.  Doing 3 XOR operation is not so bad on those
>>machines...
>
>I do not agree totally with you on the reasons of Slate/Atkin victories (earlier
>post). IMHO, they might win by other factors, not only bitboard. The factors
>were probably revolutionary ideas accompanying with bitboard. I know that many
>ideas and their implementations could occur and become clear in bitboard.  So
>the first inventors of bitboard would have advantage of two sources of ideas:
>one from traditional representations, one from their new structure.
>
>I think, if two chess programmers are similar (same knowledge, ideas, technique,
>etc.), the one programming bitboard has not any advantage compare with the other
>on computers not 64 bit, even though he has to work harder.
>
>Pham


I don't want to start a holy-war about bitboards vs mailbox programs.  But one
simple idea.  If you take a program that needs 64 bit words, and run it on a
64 bit architecture, the 'data density' inside the cpu is really useful since
it is gating around 64 bit values, and you need 64 bit values, so the bandwidth
inside the CPU is utilized.  if you take a 32 bit program, and run it on a 64
bit architecture, 1/2 of every register, 1/2 of every internal bus, 1/2 of
every internal clock cycle, is wasted.  Because you are pumping 1/2 the data
internally that the cpu is capable of.

I (or someone working with me) ran a test a couple of years ago... taking a
normal gnuchess and a normal crafty, and running both on a PC to get a benchmark
number for each.  Then the same two programs were compiled and run on an older
alpha, and not a very fast one...  gnu ran right at 2x faster, Crafty was almost
3.5X faster.

That is pretty significant.  Now whether someone can beat my move generator
with an 0x88 (or something better) is a question.  Whether they can beat my
evaluator using 0x88 is another question.  But it is pretty obvious that on a
PC they had better beat me by a factor of two, or I will catch up on the
64 bit machines.  And then some of the bitboard wizadry comes in handy.  such
as very simple tests to answer questions like "here is a bitmap of my passed
pawns, do I have an outside passer on one side, or do I have an outside passer
on both sides of the board?"  Ditto for "here is a bitmap of my candidate
passers, ..."  Right now, on the PC, those operations are pretty expensive
and dig into the advantage of bitmap evaluations.  But on the 64 bit machines,
those operations lose _all_ of their penalties, and begin to look pretty good.

I wouldn't suggest that anyone rewrite their working code.  But I made the
decision to do this several years ago.  I haven't found it a disadvantage on
32 bit machines, and I really doubt it will be a disadvantage on 64 bit
machines.

you have to think "data density".  Which is what made our move generator and
some evaluations on the Cray so very fast.  But not until you start "thinking
outside the box" and asking "how can this architecture help me do things more
efficiently?" rather than "How can I make my program run on this architecture?"

Those are two vastly different questions.  With vastly different answers.



This page took 0.01 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.