Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Piecelist or bitboard

Author: Vincent Diepeveen

Date: 07:58:56 12/17/02

Go up one level in this thread


On December 17, 2002 at 10:53:44, Andreas Guettinger wrote:

>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;
>>
>
>Wow, evolution really is convergent! :)
>
>I came exactly to the same structures without ever looking at the source code of
>another program. My friends to all bitboards anyway.
>
>But on the other hands it is really straightforward. 0x88 my not gain much
>during conversion to 64Bit processors, but it's already pretty fast and also
>especially to easy to write. My first "scratch" version of my movegenerator was
>already _almost_ bugfree, and got the same perft NPS as Crafty on my system.
>Which of course means nothing, because we don't play perft, we play chess, it
>just shows that you can't do much wrong in writing a 0x88 movegenerator.
>
>
>regards
>Andreas

just for the record but this ain't 0x88 either. 0x88 had some advantages
in assembly in the past, nowadays branches are very slow on the cpu, so
the 'gnuchess' datastructure is great.

I wouldn't use the tables nextpos/nextdir as they are though.
they are a bit big and slow :)

Best regards,
Vincent




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.