Author: Russell Reagan
Date: 02:03:08 01/08/03
Go up one level in this thread
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.
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.