Author: Rafael Andrist
Date: 02:49:43 04/28/01
Go up one level in this thread
On April 28, 2001 at 00:20:24, Dann Corbit wrote:
>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.
Precompute the attack tables for every possible piece constellation in the
lines/diagonals (in a line, there are 2 ^ 8 = 256 possibilities)
Use a 2-dimensional arrays like unsigned __int64 RookHorinzontal[64][256]
and unsigned __int64 RookVertical[64][256], and then you have simply to 'OR'
them to get the moves. If you want only the captures you make an additional
'AND' with the bitboard containing the opponent piece.
To get the information about the piece constellation in line or diagonal easily,
you use rotated Bitboards.
Rafael B. Andrist
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.