Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: algorithm question

Author: Gerd Isenberg

Date: 14:36:03 09/09/02

Go up one level in this thread


sorry, you use delphi but not c. Therefore a few comments may help...

bool isConnected(BitBoard &theBB /* call by reference */, int from, int to)
{
 if (Distance(from, to) <= 1)
  return true;
 // get all adjacent squares still in the set
 BitBoard adjacentBB = sKingAtta[from] & theBB;
 // reset squares in the set, to only traverse a square once
 theBB &= ~adjacentBB;
 while (adjacentBB)
 { // for all squares ...
  int sq = findLSBAndReset(adjacentBB); // gets index of lsb with reset
  if ( isConnected(theBB, sq, to) ) return true;  // and do the recursive call
 }
 return false; // no connection found so far
}

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.