Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Square array and piece arrays (with bitboards!)

Author: Wylie Garvin

Date: 19:58:50 01/31/02

Go up one level in this thread


On January 26, 2002 at 14:53:42, Sune Fischer wrote:

>On January 26, 2002 at 14:38:06, Russell Reagan wrote:
>
>>>When I did the last thing my movegen doubled its speed, avoid stupid check as
>>>much as you can, better to design the structures so it can be avoided.
>>
>>What do you mean by "stupid check"? Do you mean a check as in "an enemy piece
>>attacking the king", or do you mean checking variables in your program, such as
>>"if" statements?
>>
>>Russell
>
>I mean don't loop through the board to find pieces, create structures so you can
>look them up cheaply :)
>
>-S.

Hi guys,

I use a bitboard representation but to know what bitboards to update when moving
you need an array with the type of piece on each square as well.  Well, I
recently decided that rather than the *type* of piece, I would number all pieces
from 1..N and store the *number* of the piece on each square.  I also maintain a
piece list with the square and type of each piece.

This makes moving pieces slightly more taxing, but it has one tremendous
advantage for me: as long as I re-order the pieces in the piece list to a
canonical order when there are fewer than 6 of them, a lot of the early hassle
in doing an EGTB lookup is skipped (i.e. choosing the proper bitboards for the
databases, and finding the pieces within those bitboards).  This used to be >30K
of generated assembly code which I replaced with a ~1.6K table.  =)

Just goes to show that sometimes less isn't more.  :)
wylie



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.