Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitboard engines

Author: Bo Persson

Date: 04:49:24 08/04/02

Go up one level in this thread


On August 03, 2002 at 13:57:37, Russell Reagan wrote:

>On August 03, 2002 at 06:47:20, Bo Persson wrote:
>
>>I have no real use for AllPieces in my program,
>
>I am testing out different ideas, and the only use I can see for all pieces
>bitboard would be to determine if a square is occupied or not.
>
>>so I don't store that.
>>Occationally, I need its complement EmptySquares which is then computed as
>>
>>~(LitePieces | DarkPieces)
>
>This is one thing I was thinking about. How do you determine when it's better to
>have a bitboard and incrementally update it, and when it's better to compute a
>bitboard from the ones you incrementally update?

Testing. :-)

I noticed that I used the EmptySquares in just a few places, but updated it a
lot. Every move is 1-4 updates to this map!

Some of its uses could actually be rewritten using other maps, and for the
remaining, infrequent cases I compute the value if needed.

>It seems like it would be best to have as few bitboards to incrementally update
>as possible, since you will be updating them over and over and over, and then
>when you get to evaluation, it only costs a small amount to compute one compared
>to all of the incremental updating you did to get there.
>
>>I also don't have bitboards for the kings. As there will always be just a single
>>bit set in these anyway, I just store the bit index/square number for the kings.
>
>Why don't you have a bitboard for kings? How do you detect if a king is in
>check? I would think that you would do:
>
>if (whiteKing & blackAttacks)
>    // then king is in check
>
>How do you do this if you don't have a king bitboard?

Well, I write it

if (DarkAttacks.Contains(LiteKingSquare))

:-)

The bitboard class has functions optimized for testing the bits of just the byte
that contains a particular square.

Here's something for the C++ freaks:

   template<int RotationAngle>
   class RotatedBoard : public BitBoardBase
   {
   public:
      ...

      __forceinline bool Contains(Square PieceSquare) const
      { return (ByteOf(PieceSquare) & ByteMask[Rotate(PieceSquare)]) != 0; }

      ...
   };


I am not optimizing for 64 bit processors yet. :-)


>>An array of pieces is a quick way to find what pieces is on a gives square.
>>Basically it is a map from Square to Piece, while the bitboards are mapping from
>>Piece to Square. You might have use for both.
>
>I am toying around with bitboard approaches, 0x88 approaches, and also hybrid
>approaches. I'm not done yet, but I have a feeling that a hybrid will produce
>the best results when I'm through.
>
>Russell


Bo Persson
bop2@telia.com



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.