Author: Gerd Isenberg
Date: 07:44:06 03/24/04
Go up one level in this thread
On March 24, 2004 at 05:21:09, Vasik Rajlich wrote:
>On March 23, 2004 at 16:44:21, Gerd Isenberg wrote:
>
>>On March 23, 2004 at 16:25:52, Gerd Isenberg wrote:
>>
>>>On March 23, 2004 at 15:31:36, Gerd Isenberg wrote:
>>>
>>>>On March 23, 2004 at 13:21:33, Anthony Cozzie wrote:
>>>>
>>>>>After seeing Joachim's post that SMK solves this, I thought for about 5 seconds,
>>>>>and realized it isn't as hard as I thought.
>>>>>
>>>>>Step 1. Compute immovable pawnstructure. My guess is that he does this anyway.
>>>>>
>>>>>So here we recognize that that E3-F2-G3 is completely locked. This is not too
>>>>>hard to do, although I haven't worked out the mechanics completely.
>>>>>
>>>>>Step 2. Compute trappable squares.
>>>>>
>>>>>We simply floodfill from each square, and count the number of squares it can
>>>>>reach. This would be very slow, but we can speed it up as follows:
>>>>>
>>>>>We divide the board into 4 symmetric regions. (a piece will never get trapped on
>>>>>the center)
>>>>>
>>>>>Example: E1, F1, G1, H1, G2, H2, H3, H4
>>>>>
>>>>>We then check for at least 1 immoveable pawn, before floodfilling in that
>>>>>region.
>>>>>
>>>>>Step 3. Store into the pawn hash.
>>>>>
>>>>>And now we have a very quick test to determine if a piece can be trapped. This
>>>>>will cull out 99.999% of references.
>>>>>
>>>>>anthony
>>>>
>>>>Interesting idea to hash trappable squares by pawn structure!
>>>>
>>>>One has to distinguish between bishop-, rook- and queen-fills.
>>>>
>>>>What about this idea:
>>>>Two 90 degree rotated bishop or rook attack kogge-stone fills, excluding tabu
>>>>squares. If both sets are empty, there is a potentially trapped bishop square.
>>>>
>>>>Something like this:
>>>>
>>>>bool isTrappedBishopSquare(BitBoard singleSquareSet, BitBoard tabu)
>>>>{
>>>> BitBoard a1h8 = getA1H8Attacks(singleSquareSet) & ~tabu;
>>>> BitBoard h1h8 = getH1H8Attacks(singleSquareSet) & ~tabu;
>>>> // consider popCount (a1h8E | h1a8E)
>>>> BitBoard a1h8E = getH1H8Attacks(a1h8) & ~tabu;
>>>> BitBoard h1a8E = getA1H8Attacks(h1h8) & ~tabu;
>>>> return ( a1h8E == 0 && h1a8E == 0 );
>>>>}
>>>>
>>>>For all potentially squares of interest...
>>>
>>>
>>>BitBoard trappedBishopSquares = 0;
>>>BitBoard tabu = GetOwnNoneMovablePawns() | ...;
>>>BitBoard potb = ~tabu; // exclude tabu squares from the potential trapped
>>>while ( potb ) {
>>> BitBoard ssqs = potb & -potb;
>>> BitBoard a1h8 = getA1H8Attacks(ssqs) & ~tabu;
>>> BitBoard h1h8 = getH1H8Attacks(ssqs) & ~tabu;
>>> BitBoard a1h8E = getH1H8Attacks(a1h8) & ~tabu;
>>> BitBoard h1a8E = getA1H8Attacks(h1h8) & ~tabu;
>>> potb &= ~(a1h8 | h1h8 | ssqs);
>>> if ( a1h8E == 0 && h1a8E == 0 )
>>> trappedBishopSquares |= (a1h8 | h1h8 | ssqs);
>>>}
>>>
>>>
>>>Ok, there is still a lot to improve...
>>
>>BitBoard trappedBishopSquares = 0;
>>BitBoard tabu = GetOwnNoneMovablePawns() | ...;
>>BitBoard 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 )
>> trappedBishopSquares |= (a1h8 | h1h8 | ssqs);
>>}
>
>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).
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;
}
If tabu is empty and potb is all set, the routine terminates after two loop
cycles. The routine may be improved considering the fact that bishops can't
change the color of their squares...
>
>I am slightly unclear on what exactly you are trying to do. If "immovable pawn"
>is one which is absolutely fixed, as in Tord's position, then the penalties
>should be huge, and they will almost never apply.
Inside hashed pawn evaluation something like this:
// ownBackward contains even isolated with weak stopp square!
staticTabu = ownBackward | ownRamsNotDefendableByOwnMovable();
pawnhash->TrapBish1[own] = getTrappedBishopSquares(-1ULL, staticTabu, 3);
dynTabu = ownBackward | ownRams() | enemyPawnAttacks();
pawnhash->TrapBish2[own] = getTrappedBishopSquares(-1ULL, dynTabu , 3);
and finally in bishop eval something like this:
(instead popCount one may use cheaper boolean statemants)
bishEval -= PENALTY_TRAPPED_FOREVER *
(popCount( pawnhash->TrapBish1[own] & bishops[own])
- popCount( pawnhash->TrapBish1[ene] & bishops[ene]));
bishEval -= PENALTY_TEMPORARY_TRAPPED *
(popCount( pawnhash->TrapBish2[own] & bishops[own])
- popCount( pawnhash->TrapBish2[ene] & bishops[ene]));
In Tord's Position with (closed) backward f2 and the rams e3,g3 not defended or
defendable by own movable pawns ( ~(rams|backward)), the bishop on g1 becomes
the PENALTY_TRAPPED_FOREVER.
Cheers,
Gerd
>If "immovable pawn" is one
>which is just slightly more fixed, then the penalties should be mild and will
>often apply. I'd much favor the second approach, but it won't help you solve the
>extreme position.
>
>Also note that Shredder does not solve this position. It has a hyper-optimistic
>scoring for endgames, and the -1.4 score is nothing special. Put the bishop
>"back" on c1, take away white's a-pawn, and I'm sure you'll get a score which is
>even worse. In order to consider this solved, the score would need to be -3.0 or
>so. I think it's just giving a general penalty for the bishop.
>
>Vas
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.