Author: Russell Reagan
Date: 12:46:42 07/01/04
Go up one level in this thread
On July 01, 2004 at 11:06:54, Tony Werten wrote:
>Suppose you want to give a bonus if you attack a square, 1 away from the king
>and a smaller bonus for 2 away and an even smaller 1 for 3 away.
>
>If you loop over the squares (with fe 0x88) you will get some thing like
>
> bonus+=king_attack_bonus[king_dist[square-kingsquare+0x77]]
>
>I only need a k_dist table (used very often) and a bonus table wich I can keep
>at a different place
You can do the same if you use bitboards. Convert the bitboard coordinates to
0x88 coordinates. I think you posted the fastest code here yourself. Something
like:
int bb2x88 (int sq) { return sq + (sq & 56); }
Please don't tell me you are going to avoid using your superior algorithm
because of two ADDs and two ANDs :)
You could even use both 0x88 and bitboards if you wanted. It is not too much
trouble. Just maintain a 128-element board array instead of a 64-element array
and do a very small amount of coordinate conversion as needed. I believe
bitboards and 0x88 are not mutually exclusive. Maybe a very small amount of
overhead, but you get more tools to work with.
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.