Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitboards

Author: Daniel Clausen

Date: 07:06:11 02/04/04

Go up one level in this thread


On February 04, 2004 at 09:46:08, Jeff GAZET wrote:

>hi,
>
>i'm new to this forum and i have a question about bitboards :
>To move a piece from square1 to square2, to know wchich bitboard to modify
>(white_knights, white_rooks...), do i have to look at the byte square into each
>bitboard to know which to modify ? Is there a simple way to do it ?

I'm not quite sure what you mean with "byte square into each bitboard", but I
try to answer anyhow. :)

A move in my case contains not only information about the from-  and the
to-square, but also about the type of piece which moves. (and other things).
What I do is basically this:

makeWhiteMove(Board* b, Move mv)
{
   [...]

   switch(mv.pieceType)
   {
      case KNIGHT: update white_knights;
                   update white_pieces;
                   [...]
                   break;

      case ROOK:   update white_rooks;
                   update white_pieces;
                   [...]
                   break;

      [...]

   }

   [...]
}

Alternativly, if your move type doesn't contain the piecetype information, you
have could look in the pieces[64] array of your board structure. If you also
don't have that, then you really have a problem, because then you have to check
all bitboards and see in which one the bit is set for your from-square.

HTH

Sargon



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.