Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Bitboards in Crafty

Author: Zach Wegner

Date: 22:56:09 05/25/03

Go up one level in this thread



>BITBOARD Mask (int i) {
>	return (BITBOARD)1 << i;
>}

Here lies your problem. In crafty, you will see:

#    define MaskL(a)      (((unsigned long)(-1L))<<(a))
...
#    define mask_1        MaskL(63)
..
for (i=0;i<64;i++){
...
  SetMask(i)=mask_1>>i;
...
}

Your masks are reversed.

P.S. Crafty already has a function to display bitboards.
in utility.c:

void DisplayBitBoard(BITBOARD board) {
  int i,j,x;
  for(i=7;i>=0;i--) {
    printf("  %2d ",i*8);
    x=board&255;
    board>>=8;
    for(j=128;j>0;j=j>>1)
      if(x & j)
        printf("X ");
      else
        printf("- ");
    printf("\n");
  }
}



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.