Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Correction!

Author: Gerd Isenberg

Date: 13:39:51 03/24/04

Go up one level in this thread


>I guess a third fill is necessary to solve that...
>(or something smarter)
>
>Eg. to look whether the set of all safe squares reachable in one bishop move is
>equal to the set of safe squares reachable in three bishop moves.
>Also forgotten to pass the propagator (empty, allowed or ~tabu) to the kogge
>stone attack getter or filler.
>
>BitBoard getTrappedBishopSquares(BitBoard potb, BitBoard allowed, int n)
>{
>   BitBoard trappedBishopSquares = 0;
>   potb &= allowed; // exclude tabu squares from the potential trapped
>   while ( potb ) {
>      BitBoard fromBB  = potb & -potb;
>      BitBoard inOne   = fillBishopAttacks(fromBB, allowed) & allowed;
>      BitBoard inTwo   = fillBishopAttacks(inOne,  allowed) & allowed;
>      BitBoard inThree = fillBishopAttacks(inTwo,  allowed) & allowed;
>      // tag all reachable in up to three moves as done
>      potb &= ~(fromBB|inOne|inTwo|inThree);
>      if ( inOne == inThree && popCount(inOne) < n )
>         trappedBishopSquares |= (ssqs|inOne|inTwo);
>   }
>   return trappedBishopSquares;
>}
>
>Without any warranty ;-)

yes, the propagator (own none movable pawns) should be decoupled from the
allowed/tabu set...

// fixed is subset of tabu (may be equal), the set of all own blocked
//  and backward pawns.
// tabu may contain enemy pawn attacks which don't terminate the attack ray

BitBoard getTrappedBishopSquares(BitBoard fixed, BitBoard tabu, int n)
{
   BitBoard trappedBishopSquares = 0;
   BitBoard potb = ~tabu;
   while ( potb ) {
      BitBoard fromBB  = potb & -potb;
      BitBoard inOne   = fillBishopAttacks(fromBB, ~fixed) & ~tabu;
      BitBoard inTwo   = fillBishopAttacks(inOne,  ~fixed) & ~tabu;
      BitBoard inThree = fillBishopAttacks(inTwo,  ~fixed) & ~tabu;
      // tag all reachable in up to three moves as done
      potb &= ~(fromBB|inOne|inTwo|inThree);
      if ( inOne == inThree && popCount(inOne) < n )
         trappedBishopSquares |= (fromBB|inOne|inTwo);
   }
   return trappedBishopSquares;
}


>
>Cheers,
>Gerd



This page took 0.01 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.