Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Best use of attack tables

Author: Dann Corbit

Date: 21:20:24 04/27/01

Go up one level in this thread


On April 27, 2001 at 23:57:10, Miguel A. Ballicora wrote:

>On April 27, 2001 at 21:28:14, Dann Corbit wrote:
>
>This is what I do in Gaviota, which by no means is guarantee of anything.
>
>>Precomputing attack tables is a snap, of course.  The burning question is, how
>>are they best utilized?
>>
>>I notice that nobody makes pawn attack tables.  Is that because pawn attacks are
>>too trivial to compute on the fly?
>
>I do two pawn attack tables, left and right attack. I compute the addition
>of both (OR) on the fly.
>
>>What is the typical savings of attack tables compared to performing the
>>computations on the fly?
>
>In my case, I believe that it is irrelevant because it is not a bottleneck at
>all (the pawn tables, Q B and R are very expensive).
>
>>Is there any advantage to trying to compress the attack tables?
>
>The advantage would be handling 32 bits variables rather than 64, which kills
>me, but I have the feeling that the computation could be more expensive.
>
>>Do you use attack tables against an entire side at once, or only against pieces
>>by set or even individual chess men?
>
>I use it in several ways. I kept them individually so I use them to generate the
>moves, and calculate mobility. I use them blended too, for instance, to find
>"bad squares" for rooks for instance. (i.e. I generate on the fly B+N
>attacktables).
>
>>Are they used in MVV/LVA primarily, or during all phases of evaluation?
>
>You mean in SEE?

Yes.

>I use them in generation and in all phases of evaluation. For that reason,
>I update them in makemove. That makes my program very slow. I still
>have to optimize this.
>
>>
>>Obviously, knight attack tables can be performed with a single & operation, but
>
>you mean OR'ed? adding all knights attacks in one bitboard?

Consider this diagram:
[D]k7/8/2p1p3/1pR2p2/3N4/1p1B1p2/1Rp1p3/4K3 w - -

The lone knight is attacking all the pawns.  In fact, I know that a white knight
at that location will attack any black pieces or pawns sitting where those pawns
are.  If I | {or} together all the black pawns, for instance, I can & with my
knight-attack bitboard for a knight at D4 and know that he is (in this case)
attacking all of the pawns in a single operation.  Exactly the places where the
black pawns are standing are the places attacked by a white knight (or defended
if it were a black knight).

With a knight, I don't have to worry if anything is in the way, since he can hop
right over.  With a bishop (for instance) I have to worry about it.  For
instance, consider this position:
[D]7k/p5p1/1p3p2/8/3B4/2P1P3/1p3p2/1K3Nn1 w - -
That bishop does not attack the pawn at b2 or the pawn at f2 because my own
pawns are in the way.  He does not attack the pawns at a7 or g7 because the pawn
at b6 and f6 are in the way (he does -- however -- pin the pawn at a7 because
moving it would expose b6).

So, with knights the calculation is instantaneous.  With bishops and rooks (for
instance) it seems much more complicated.  It can only show me pawns and pieces
they "might" attack if nothing is in the way.  Is there an easy way to simplify
is what I am trying to ask.

>>what do you do with bishops, queens, etc, where your own man or an intervening
>>piece can get in the way?  Are they used only as a pre-test to see if the rest
>>is worth calculating?
>
>I calculate them with using rotated bitboards.
>
>>I thought of using all your own men, &'ed together as a mask, and then clearing
>>everything past a "pierce" mark, but that would probably be as expensive as
>>computation of the attack.
>
>When I started my program, I use them to generate statically legal moves.
>without the necessity to try them with makemove. In other words, my generator
>gave the list of legal moves and nothing else.  I enjoyed doing it but... How
>silly! I thought it was a smart thing to do but it was slow as hell!
>I only use it now for check evasion.
>It is useful because I can say right away whether I have to extend because there
>is only one reply (i did not implement it yet) or is a checkmate.
>
>Basically I used them for everything.
>
>Regards,
>Miguel



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.