Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: BitBoard flop

Author: Michael Neish

Date: 22:10:57 02/03/00

Go up one level in this thread


On February 03, 2000 at 14:48:48, James Swafford wrote:

>I completely agree.  I began with a bitmap engine (Tristram),
>which I learned to implement studying Crafty.
>
>Galahad started out that way, but in the spirit of
>experimentation I changed to the "mailbox" method
>shown in TSCP, leaving only pawn bitmaps.  I hate it.
>I will likely change back if I ever get the time.

It's good that you mention it, because I was thinking about doing the same,
or at least tackling Pawns differently.  To save having to extract the
Pawn squares one by one from the PawnSquares bitboard I was thinking of
doing them all at once with one call and storing their squares in an
array, then dealing with them one by one in the Eval() function.  Not
sure whether that method would be good as the number of Pawns gradually
goes down as they are swapped off, but it would probably be faster at
the start of the game (for the way my program runs at least).

Well thanks to those who replied to my initial question.  I can see
now that bitboards are still not universally acknowledged as "superior".
From what little experience I have, I think their performance depends
critically on the speed of the FirstOne() routine, or equivalent, for
extracting the most or least significant 1-bit.  In my case I do this:

int GetBits(BITBOARD a)

{

/*
    test is a Bitboard of value 0xFFFFFFFF00000000 which allows half of
    Bitboard a to be tested.  If there are no 1's in that half, a is
    shifted 32 bits and tested again.
*/

 	if (a & test) return(63 - __cntlzw((a>>32)));
	else return (31 - __cntlzw(a));

}

If anyone has a suggestion that would work faster, I would appreciate it if you
could let me know.  There is no intrinsic function on the Mac (as far as I know)
which will allow trailing bits to be counted, hence I count the leading zeroes
and subtract the value of _cntlzw from 63 or 31.  Obviously this slows the
routine down quite a bit.  And also, _cntlzw cannot be applied directly to
unsigned long long integers, hence the split.

Interesting discussion.  Obviously I was naive to expect my program to run like
a cheetah after putting Bitboards in.  Looks like it's going to be a struggle.

Cheers,

Mike.




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.