Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: and finally?

Author: Gerd Isenberg

Date: 23:00:30 03/24/04

Go up one level in this thread


On March 24, 2004 at 20:48:00, Sune Fischer wrote:

>On March 24, 2004 at 18:59:02, Gerd Isenberg wrote:
>
>>Some minor changes because inOne == inThree is not general enough.
>>Better to look for no further growing:
>>if ( (inThree & ~(fromBB|inOne|inTwo)) == 0 && ...
>>
>>
>>// 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);
>>      inThree &= ~(fromBB|inOne|inTwo); // growing?
>>      if ( inThree == 0 && popCount(inOne|inTwo) < n )
>>         trappedBishopSquares |= (fromBB|inOne|inTwo);
>>   }
>>   return trappedBishopSquares;
>>}
>>
>>popCount > n considers the whole fill area reachable in two moves.
>
>Hi Gerd,
>
>I have not fully understood what it is you do.
>Can you explain what the while loop does?
>
>I was think one could just do something like
>
>  bb = FillBishopOccluded((D4|D5|E4|E5),~tabu);
>  bb = FillBishopOccluded(bb,~tabu);
>  return (~FillBishopOccluded(bb,~tabu));
>
>So all those squares not reachable from the center is trappable squares.
>
>It needs to be done for both sides, as the tabu isn't the same for black and
>white, assuming I have understood it correctly that is.
>
>-S.

Hi Sune,

yes, your idea seems fine because such positions are very unlikely ;-)

[D] 7k/p7/2p1p1p1/2P1P3/2pBp3/2P1P3/8/6K1 w - -

I start instead of the center, with the first (lsb)  square (bit) set in the
potential trapped bishop attacks so far, most likely it starts with a1. Three
fills and tagging all in 0,1,2,3 reachable squares as done (they are either
trapped squares if third fill indicates no further growing, or not trapped
squares if third fill grows).

If the third fill don't grows anymore, and the popcount of the filled area is
less than n (let say 4) the filled area is considered as trapped.

With empty tabu set the while loop terminates in two runs (all light squares,
all dark squares). Worst case seems 10 runs with 10 not connected ilands and
eight trapped.

[D] 8/4k3/7K/3p4/p1p1p1p1/P1P3P1/3P1P1P/8 w - -

Cheers,
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.