Computer Chess Club Archives


Search

Terms

Messages

Subject: Correction!

Author: Gerd Isenberg

Date: 13:15:47 03/24/04

Go up one level in this thread


>>Interesting, keep posting, we're watching :-)
>
>Ok, lets make a routine providing a set of squares, where bishops are trapped,
>based on the passed set of potential bishops squares (the whole board, or some
>parts or the board, as Anthony suggested), tabu squares (see below) and an int
>nSafeSquares, defining a limit of safe target squares (eg. < 3).
>

Oups, algorithms on the fly and during work with less time...
Forget that routine!!

>BitBoard getTrappedBishopSquares(BitBoard potb, BitBoard tabu, int nSafeSquares)
>{
>   BitBoard trappedBishopSquares = 0;
>   potb = ~tabu; // exclude tabu squares from the potential trapped
>   while ( potb ) {
>      BitBoard ssqs  = potb & -potb;
>      BitBoard a1h8  = getA1H8Attacks(ssqs) & ~tabu;
>      BitBoard h1a8  = getH1A8Attacks(ssqs) & ~tabu;
>      BitBoard a1h8E = getH1A8Attacks(a1h8) & ~tabu;
>      BitBoard h1a8E = getA1H8Attacks(h1a8) & ~tabu;
>      potb &= ~(a1h8 | h1a8 | a1h8E | h1a8E | ssqs);
>      if ( a1h8E == 0 && h1a8E == 0 && popCount(a1h8 | h1a8) < nSafeSquares )
>         trappedBishopSquares |= (a1h8 | h1a8 | ssqs);
>   }
>   return trappedBishopSquares;
>}


There is a huge locigal error with the trapped bishop idea.
In this position, bishops on a1 or c1 are not considered as trapped, but a
bishop on b2.

[D] 8/2k4p/8/8/p1p5/P1Pp4/3P4/2B4K w - -

On b2 there are two safe targets, a1 for a1h8- and c1 for h1a8-direction.
Both 90 degree fills from a1 in h1a8- and from c1 in a1h8 directions are empty
and therefore b2 is considered trapped.

On a1 or c1 there is only one direction to b2 and the 90 degree fill is not
empty. And traversing starts with lsb a1. In the mirrored position b7 is
traversed before a8,c8 and therefore "my algo" detects {b7,a8,c8} correctly as
trapped set.

[D] 2b4k/3p4/p1pP4/P1P5/8/8/2K4P/8 b - -

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 ;-)

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.