Author: scott farrell
Date: 04:08:36 01/08/03
Go up one level in this thread
On January 08, 2003 at 05:03:08, Russell Reagan wrote:
>On January 08, 2003 at 04:43:12, scott farrell wrote:
>
>>for (sq=0; sq<64;sq++){
>> if( (mask[sq] & whiteQueenAttacks) !=0)
>> attackers++;
>> if( (mask[sq] & blackQueenAttacks) !=0)
>> defenders++;
>> ......
>>}
>>if (attackers>defenders)
>> ATTACK_NOW_!!!!!
>>
>>atleast this method I dont have ot itereate the actuall attack vectors, and
>>avoid slow msb/pop type routines.
>
>If are only interested in the number of attackers, instead of doing a
>64-iteration loop, just do a popcount. It shouldn't be any slower than what you
>are doing above, and it will only take N iterations when there are N attacks on
>the board, so it should always be faster.
>
So I guess you are saying:
whileThereAreMorePieces
getAttackers().popcount
getDefenders().popcount
So you iterate the pieces instead of the squares, that is better than I had, but
still a lot of loops.
Scott
>As for using Ed's idea with bitboards, I am interested in this too, but it's
>late and my brain isn't all here, so maybe I'll have some other ideas after I
>get some sleep :)
>
>Russell
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.