Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: questions about dynamically updating attackboards

Author: Sune Fischer

Date: 14:43:55 08/23/03

Go up one level in this thread


On August 23, 2003 at 17:32:06, Andrew Williams wrote:

>On August 23, 2003 at 17:19:20, Sune Fischer wrote:
>
>>On August 23, 2003 at 16:24:28, Andrew Williams wrote:
>>
>>I know this scheme very well, perhaps we should compare nps ;)
>>
>
>PM does about 170knps.
>
>>Do you also xor out the changes?
>>
>>One problem I see with this, is that 32 bits is too big to make use of SEE by
>>table lookups.
>>
>
>Yes. It's nowhere near as nice Ed's scheme.
>
>>Another problem is the number of squares that needs updating in the endgame with
>>sliding pieces, it's just enourmous.
>>
>
>Yes.
>
>>>2. Go over all 64 squares, masking out the attacks identified in (1) above.
>>
>>You don't need all 64 squares, just the changes.
>>
>
>Yes. This is one of those things I keep "in hand" for when I run out of new
>things to try.

I think you should have a factor 2 in move making here, no need to run over all
64 bit squares.

You compile a list of squares that need updating, to,from etc. and then go
through the pieces attack them.
It's quite compact in fact:

inline void BOARD::GenAttackers(uint32 affected,uint co) {
 register uint ix;
 register BITBOARD xors;

 while (affected) {
   ix = FirstBit32(affected);
   xors = attack_ix[ix];   // old attack board
   attack_ix[ix] = GenAttack(ty_ix[ix],sq_ix[ix],co);  // new attack board
   xors ^= attack_ix[ix];                   // the changes
   while (xors)
     attack_sq[GetFirstBitAndClear64(xors)] ^= 1<<ix;
     affected &= affected-1;
   }
 }
}


>>>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.
>>
>>Hmm, you have to cleanup this piece also I think.
>>
>
>Yes. This could be done better too.

The good thing is this captured piece is treated like all the others, no added
complexity.

>I definitely wouldn't claim that PM's approach is optimal. It just works. If I
>ever get really concerned about it, I can eliminate some of the unecessary work.
>I don't think it's critical to do it at the moment.

It's the fun part though :)

-S.

>Andrew



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.