Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Attack table

Author: Scott Gasch

Date: 11:20:38 10/17/05

Go up one level in this thread


On October 16, 2005 at 06:29:21, JW de Kort wrote:

>Hi,
>
>Is there some where on the internet a site were i can find information on how to
>quickly generat attack tables in a 0x88 chess program. I have been looking but
>could not find anything.
>
>regards
>
>Jan Willem

Attack tables meaning this piece is attacking that square?  As far as I know
there are two ways to do it: incrementally and at the leaves.

I do the latter -- in eval when I am computing piece mobility I also toggle a
bit per piece type in the attack table.  I also toggle on xray bits in these
same mobility loops.  Once all pieces have had their mobility computed I have a
full attack table generated.  Also, in eval I score pawns first, then minors,
then rooks, then queen and finally kings.  The bonuses are:

    1. When you're doing piece X's mobility you know what squares it will be
       instantly taken by a lower-valued piece (because you already did the
       lower valued piece mobility code)
    2. By the time you are ready to consider king safety you have a bunch of
       attack table bits around the king that tell you what enemy pieces are
       pointed near it.

I don't know who does incremental attack table generation -- I thought about it
for a while but I never gave it a try because it seems like a big mess.  Every
time you move a piece you basically turn off all attack table bits from where it
was and turn on all attack table bits from where it went.  If this was all it
would not be so bad.  But consider: every time you move a piece you can
potentially "expose" other piece's attacks.  So once you fixed up the from/to
attack table bits you then need to go identify what other pieces you may have
uncovered and fix up their attack bits.

All in all I don't know which is faster -- incremental or reconstructing the
table at every eval call.  I guess it depends on how often you call eval (any
internal nodes?).  Maybe someone who has written an incremental attack table
engine can speak to this.

Also, check out Ed Schroder's "Programmer Stuff" page for an idea for a basic
data structure for attack tables.

Good luck,
Scott



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.