Computer Chess Club Archives


Search

Terms

Messages

Subject: 0x88 revisited

Author: Tony Werten

Date: 15:25:51 11/01/02


Hi,

we had a discussion lately about an array that wouldn't hurt the cache too much.
I came up with something better. It's in pseudo pascal.

can_attack:array[king..pawn,0..8] of uint
attack_dir:array[king..pawn,-$77..$77] of uint

can Piece on SquareA attack SquareB?

tmp:=SquareA-SquareB+$77;
probe:=tmp shr 5;
bittest:=1 shl (probe and 31);
if can_attack[piece,probe] and bittest<>0 then
begin
  //piece can potentially attack SquareB
  // if piece is slider then only now you have to probe
  // the big table attack_dir and check if there are blocking pieces
end;

The filling of can_attack  is easy now :)

cheers,

Tony

PS hope he idea is clear, just came back from a party



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.