Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Piecelist or bitboard

Author: JW de Kort

Date: 06:40:21 12/17/02

Go up one level in this thread


On December 17, 2002 at 08:56:24, Vincent Diepeveen wrote:

>On December 17, 2002 at 04:15:26, JW de Kort wrote:
>
>I do not understand why you want to change it to something
>slower.
>
>0x88 is fine.
>
>also fine is the gnuchess 4.0 datastructure
>
>int piecelist[2][18]; // containing squares of the pieces
>int piececnt[2]; // number of pieces minus king as you have that one anyway
>
>and at the end of the squares where the pieces are, you put a -1 or
>whatever that speeds up the loop a lot.
>
>int board[64]; // 0..6  empty,pawn,knight,bishop,rook,queen,king
>int color[64]; // 0,1,2=neutral
>int quickboard[64]; // 0..12 same as board also bpawn,bknight,bbishop,brook ...
>int pindex[64]; // two times 0..15 giving index in piecelist
>
>this very simple datastructure allows manipulations to be done very quick.
>
>For example if you move from a1 to a2, then all you gotta do is
>  index = pindex[a2] = pindex[a1];
>  board[a2]  = board[a1];
>  board[a1]  = 0;
>  quickboard[a2] = quickboard[a1];
>  quickboard[a1] = 0;
>  piecelist[side][index] = a2;
>
>You can do that tens of millions of times a second.
>
>>Hi,
>>
>>Currently i'am using a piecelist to keep track of the locations of the pieces in
>>my 0x88 based program. Iám thinking about removing this list and replacing it by
>>a bitboard to keep track of the piecelocations of white pieces and black pieces.
>>I'am wondering of anybody else does this (i think some one will) and if this is
>>a good improvement to spees up my engine which is terrably slow. I have good
>>expierences with other bitboards in my program. I already use bitboard to do the
>>pawn evaluations and i'am thinkin about gradually removing the 0x88 stuff to
>>replace it with bitboards
>>
>>any help appreciated
>>
>>
>>Regards
>>
>>Jan Willem


Thats true but what i find very difficult is loping alon all pieces eg when
evaluating and removing a captured piece from thet piecelist. I have to do
something lik

piecelist[sq[to]]=EMPTY

and i wondered if a bitboard would speed up matters.

In evaluation i do something like

while (!lLASTPIECE)
  if (piecelist[i] !=EMPTY)
     evaluate

and i wonderded if this could be speed uop by using a bitboard.












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.