Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: questions about dynamically updating attackboards

Author: Andrew Williams

Date: 13:24:28 08/23/03

Go up one level in this thread


On August 23, 2003 at 15:23:45, Uri Blass wrote:

>I am afraid that I did not understand it.
>I remember claims that it is possible to do it fast.
>How is it possible?
>
>Suppose that you find that the white rook stops attacking a square.
>
>If you remember only that a white rook attacked the square without remembering
>more information then how do you know that there is not another rook that is
>attacking the same square?
>
>If you check that there is not another white rook that is attacking the same
>square before updating the attack array then it does not sound so cheap to do
>it.
>
>Uri

When *I* talk about attackboards, I mean that every square has a 32-bit unsigned
integer associated with it. Each bit in one of these unsigned integers
represents one piece. If the bit is 1, it means that the piece represented by
that bit attacks the square. You are never going to be able to update this
structure very quickly. The issue is, can you justify the time it takes to
update this structure with the benefits you get from the information in it?

When I make a move, I do this (note that promotions, enpassand and castling are
a bit different):

1. Create a 32-bit uint which has a bit set for the moving piece, the captured
piece (if any) plus any piece which attacks the from square or the to square.

2. Go over all 64 squares, masking out the attacks identified in (1) above.

3. Go through all the pieces that were affected (not the captured piece of
course) and generate their attacks and mask them into the 64-uint array.

I would re-iterate that since I do this on every make-move, this is not an
efficient use of time, *unless* I use the information I get from it wisely.
However, another reason for doing it might be that I put a *lot* of time and
effort into getting it working properly; there's an element of pride that would
prevent me from ditching it, even if I were convinced that it is a bad idea.
Since I'm an amateur at this, I can afford this luxury.

Andrew




This page took 0.02 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.