Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: How do you represent chess boards in your chess programms

Author: Robert Hyatt

Date: 06:44:45 09/25/99

Go up one level in this thread


On September 24, 1999 at 19:06:53, Christophe Theron wrote:

>On September 24, 1999 at 01:36:19, Dann Corbit wrote:
>
>>On September 24, 1999 at 01:12:06, Christophe Theron wrote:
>>[snip]
>>>If somebody tells you bitboards are the way to go, don't believe him.
>>Now that's what I call a beautiful tease.
>>
>>What is the way to go?
>>;-)
>
>Bitboards give no real advantage, except that the author feels very proud of
>itself when it works (and he thinks it's so elegant!).
>
>There are simpler data structures that work very well for chess, are very easy
>to understand and program, and work on any computer, not just expensive 64 bits
>processors.
>
>Oh yes! I know, these 64 bits processors will be cheap in the future. Be
>prepared to throw your current computer into the nearest trash can if you want
>to use these bright bitboard programs!
>
>It's the general trend, isn't it? The computer industry wants you to believe
>that the word processor you have bought last year is now completely obsolete.
>You'll have to buy another one as soon as possible. And as it will be sooooo
>sloooooooow on your computer, you'll have to change your computer too.
>
>
>
>    Christophe


You can obviously have any opinion on this subject.  But I have tried _all_
the usual approaches.  Each has advantages and disadvantages.  Bitboards have
no particular problems on _any_ computer.  Modern computers are super-scalar
in design already, issuing 3-4 instructions every clock cycle when possible.
Bitboards help feed this multiple-pipeline approach, even on a 32 bit
machine.  If you run a good analysis program, you discover that only rarely do
normal programs manage to keep 3 pipes busy all the time.  So even though the
bitboard programs must execute extra instructions (extra is a misnomer as non-
bitboard programs have their own set of identifiable problems) these
instructions just happen to fit the multiple pipes just fine.

On the other hand, move generation is only _one_ part of a chess engine.
Bitboards.  But move generation fitx bitboards just fine...  the sliding
pieces are much easier to generate moves for...  and captures are much
easier/more efficient to generate moves for, since non-captures don't have
to be skipped over.  But the real benefit of bitmaps is the ability to do
clever evaluation things.  Very efficiently.  IE my recently added candidate
passed pawn / pawn majority code didn't slow me down a bit, because of the way
it is done using bitmaps rather than loops.

I'm not going to begin to claim that they are better than offset board
approaches today.  I do claim that they are absolutely _no worse_ than
using an array.  And whether you like/believe it or not, 64 bit machines
are coming. And they will be the standard PC in a few more years.  10 years
ago, people were using your same words, with the target divided by 2:  "Why
would I ever throw away my 16 bit 286 cpu?  Those 32 bit machines are only
useful for high-end applications..."  64 bits are here to stay.  Programs
that use such architectures will gain more from them than those that don't.
Just look at all the programs and programmers that had to convert to "32 bit
programming" to avoid the less efficient 16 bit stuff on new processors.  Do
you think that won't happen _again_ soon?  :)

I think (my opinion) that 'evaluation-heavy' programs will like bitmaps better
than just fast searchers will...  because the bitboard approach makes a lot of
evaluation pattern matching turn into a single AND or OR instruction.  But
until you try it for at least a couple of years, you won't ever see the
advantages (and learn how to work around the occasional problem).  It requires
a new type of thinking.  But not necessarily a bad type of thinking.

I don't recommend this as a first approach to computer chess, because it is a
good bit more complex to get off the ground quickly.  However, I used to think
it was an unworkable idea until I tried it.  And stuck with it long enough to
start thinking in bitmaps.  It took time.  And it works just fine.  When I
made the big step to convert to bitboards, I made a mental committment to stick
with them for at least 3 years to give them a chance, because at first, they are
'different' feeling. And it takes time to "think bitmaps".  But once you get
there, they work just as well as any other approach, and if you intend on doing
a lot of eval work, they become _very_ efficient...



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.