Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: optimization on reduced int range - e.g. knight-distance

Author: Gerd Isenberg

Date: 02:09:09 12/20/05

Go up one level in this thread


On December 19, 2005 at 23:11:36, Mridul Muralidharan wrote:

>
>Interesting idea Gerd , I was actually thinking of doing something similar ...
>but also mask the king and pawn attack squares into this knight walk (yep ,
>would need the knight walk path , see below).
>Ofcourse , most cases this might not be useful since you might be able to stop
>the knight walk by a well placed pawn push/king move ...
>So , the step after that was to find list of unblocked pawns and see how much
>they can influence the knight walk path , check the potential kings influence
>and see if there is an alternate path for block ... this would make it dirty and
>complicated and so not yet thrashed the idea out.
>Have not yet completed the idea to even begin coding , so seeing this helps me
>know that there is something to fall back on :-)
>
>Thanks,
>Mridul
>
Hi Mridul,

yes - a small excursion in the old 8/16-bit times. I have the feeling that
square metric based programs are relative handicapped on 32/64-bit
architectures, since the dense of information in a 32-bit word is usually rather
low with square or 0x88 coordinates and scores fitting in a 16-bit word... and
compiler are not so smart optimizing on this.

For fork-pattern or knight-walks in endings with more or less immobile
(backward, rammed) pawns i also prefere bitboard based fill-stuff.

const BitBoard notA  = 0xfefefefefefefefe;
const BitBoard notAB = 0xfcfcfcfcfcfcfcfc;
const BitBoard notH  = 0x7f7f7f7f7f7f7f7f;
const BitBoard notGH = 0x3f3f3f3f3f3f3f3f;

BitBoard getKnightAttacks(BitBoard bb)
{
  BitBoard l1 = (bb >> 1) & notH;
  BitBoard r1 = (bb << 1) & notA;
  BitBoard l2 = (bb >> 2) & notGH;
  BitBoard r2 = (bb << 2) & notAB;
  BitBoard h1 = l1|r1;
  BitBoard h2 = l2|r2;
  return (h1<<16)|(h1>>16)|(h2<<8)|(h2>>8);
}

A fork-pattern is quite simple then:

knightAttacks = getKnightAttacks(myKnights & ~pinned);
knightTargets = knightAttacks & ~myPieces & ~dominatedByOpponent;
forkVictims   = getKnightAttacks(knightTargets);

... and to have a closer look on forkVictims - whether there is more than one
enemy man, king or en prised pieces or pawns, inside that set.

Gerd






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.