Computer Chess Club Archives




Subject: Re: hanging pieces in rebel

Author: Tord Romstad

Date: 07:57:10 01/16/04

Go up one level in this thread

On January 16, 2004 at 10:51:03, Uri Blass wrote:

>On January 16, 2004 at 10:46:57, Tord Romstad wrote:
>>On January 16, 2004 at 06:44:54, Uri Blass wrote:
>>>Do you calculate things like number of pawn attackers,knight attackers,rook
>>>attackers including indirect attacks when the rook support another rook
>>>incrementally after every move?
>>Yes, except that there is no incremental updating of the data, if that was
>>what you meant to ask about.  Everything is computed from scratch at every
>>>Do you have this in a small table for the 64 squares of the board?
>>Two small tables, one for each side.  They are indexed by the 256 squares
>>of my internal board.
>I guess that you have a table when 1/4 of it is not used so I guess that having
>64 square board have some advantages.

I can live with that.  The total size of the two tables is 1 kB, which is
not a lot.  Of course I could have used 64-element tables instead, but
that would make them slower to generate.  The advantage of the 256-element
tables is that there is no need to be afraid of writing "outside the board".
When generating attacks for a knight on the square contained in the
variable sq, for instance, I can simply do like this:

for(i=0; i<8; i++)
  Attacks[sq+KnightDirs[i]] |= KnightMask;

It is possible that unrolling the loop would be even faster, but the
point remains:  I save at least one branch by not having to check
whether sq+KnightDirs[i] is outside the board.


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.