Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: 0x88 findings

Author: Tony Werten

Date: 23:10:28 02/21/06

Go up one level in this thread


This looks like you just did a rewrite of your old code. Therefor you don't take
advantage of specific 0x88 optimizations.

fe With 0x88, you don't have to generate a complete attack set on the king to
see if you just put your own king in check.

Very x88'ish is the CouldAttack(piece,from,to) function that returns wether (on
an empty board) a piece on from can attack to.

bool SelfCheckX88(move,color)
{
   if (not(inCheck) && (move!=castleMove) && (move!=epMove))
   {
     if (CouldAttack(Queen,From(move),ksq(color))
     {
         dir=GetAttackDir(From(move),ksq(color));
         for (sq=ksq(color)-dir;!(sq & 0x88);sq-=dir)
         {
             if ((piece=board[sq])!=empty) break;
         }
         if (PieceIsMyColor(piece,color)) return(false);
         return(CouldAttack(piece,sq,ksq(color)));
      }
      return(false);
   }
   return(SelfCheckFullScan(ksq(color)));
}

So, a lot of times you get away with 1 table lookup.

Giving check goes about the same, but this time you also have to check wether
the piece just moved could deliver check on the to square.

Tony




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.