Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Outside passers with one and

Author: Robert Hyatt

Date: 14:40:03 04/14/03

Go up one level in this thread


On April 14, 2003 at 15:48:48, Gerd Isenberg wrote:

>Hi all,
>
>a minor pawn pattern idea, i like to share ...
>
>With (pawn) bitboards it's pretty easy to get all passers and even to get all
>outside passers. The second was new to me, and i had the idea recently (thinking
>bitboards ;-), but i guess the "trick" is already common or well known.
>
>Instead of pattern branching after a distance compare in an inner loop over
>passers of one color, i use a separate bitscan and reset loop over this
>dedicated set of outside passers now, eg. in pawn endings.
>
>For outside passers one need a precalculated array of 2*64*2 bitboards.
>This array is indexed by color of passed pawns we are looking for, square of
>opposite king and color of side to move. It contains set bits for all squares
>with distance to promotion < king distance to promote squares, considering the
>tempo.
>
>Next step may be to avoid such loops at all, to process some single properties
>without further piece interactions. Most often one uses some piece-square
>tables, indexed by the squares of the traversed bitboard. If only the
>rank-position is significant, a simultanious (mmx) popcount of six consecutive
>bytes may be interesting, where the bytewise population counts are multipied
>afterwards with some weighting factors.

I do what you are close to hitting on.  I have a bitmask of 8 bits, indicating
whether white has a passer on a file (one bitmap) or whether black has a passer
on a file (the other bitmap).  I can now use a simple table lookup
is_outside[256][256]
that works just fine.  The first subscript is the white outside passers (files
with passers)
and the second is a bitmap of _all_ files that have black pawns (or the inverse
for looking
at black outside passers).

A single probe says "white has an outside passer or not" and another probe says
"black has
an outside passer or not."  The value returned is 0, 1 or 2, which indicate how
many outside
passers that side has.  And when I say outside passers I mean on each wing.  0 =
no outside
passers, 1 = outside passer on one wing.  2 = two outside passers on opposite
wings, which
is almost impossible to defend against.

>
>But the population count is most often rather small with outside passers, if
>any. I guess for this purpose a bitscan-loop like is fine:
>
>if ( bb )
>{
> ...
> do something( BitScanAndReset(bb) ); while (bb); // traversing bb
>}
>
>
>Cheers,
>Gerd
>
>
>
>
>passedPawns[WHITE] = pawns[WHITE] & ~filldown(allPawns|pawnAttacks[BLACK]);
>passedPawnsOutside[WHITE] = passedPawns[WHITE] &
>sOutsideSquares[WHITE][bKing][color2move];
>
>BitBoard fillDown(BitBoard b)
>{
>    // Uses Kogge-Stone parallel prefix algorithm
>           b |= b >>  8;
>           b |= b >> 16;
>    return b |  b >> 32;
>}
>
>
>BitBoard sOutsideSquares[2][64][2];
>
>
>eg.:
>sOutsideSquares[WHITE][a8][WHITE] =
> o 1 1 1 1 1 1 1  // a8..h8 invalid pawn squares (8.rank) don't matter
> 0 0 1 1 1 1 1 1
> 0 0 0 1 1 1 1 1
> 0 0 0 0 1 1 1 1
> 0 0 0 0 0 1 1 1
> 0 0 0 0 0 0 1 1
> 0 0 0 0 0 0 1*1  // a2..h2 *considers double pawn step
> 0 0 0 0 0 0 0 0  // a1..h1
>
>sOutsideSquares[WHITE][a8][BLACK] =
> o o 1 1 1 1 1 1  // a8..h8 invalid pawn squares (8.rank) don't matter
> o o 0 1 1 1 1 1
> 0 0 0 0 1 1 1 1
> 0 0 0 0 0 1 1 1
> 0 0 0 0 0 0 1 1
> 0 0 0 0 0 0 0 1
> 0 0 0 0 0 0 0*1  // a2..h2 *considers double pawn step
> 0 0 0 0 0 0 0 0  // a1..h1



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.