Older Version Newer Version

GerdIsenberg GerdIsenberg Feb 27, 2015

[[toc]]
**[[Home]] * [[Board Representation]] * [[Bitboards]] * [[Pawn Pattern and Properties]] * Defended Pawns**

Working in the bitboard centric world to determine pawn related pattern set-wise.

Each pawn, member of the own [[Pawn Attacks (Bitboards)|pawn attack set]] is obviously defended by a pawn, thus likely not a winning capture target for opponent pieces (except pawns). If a defended pawn is [[Open Pawns (Bitboards)|open]], opponent rooks on [[Pawns and Files (Bitboards)#HalfopenFiles|half-open]] files bang one's head against a brick wall.

[[#Defended]]
=Defended= 
Again, it is advantageous to keep disjoint east-west attack sets for a unique 1:1 source-target relationship. On demand we can use the union or intersection on the fly. Note that attack direction is related to the target square. East attack is from south/north-west to north/south-east
[[code]]
white pawns         defended            defended
                    from west ->        from east <-
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . 1 . . .     . . . . 1 . . .     . . . . . . . .
. . . 1 . . 1 .     . . . 1 . . . .     . . . . . . 1 .
. . 1 . . . . 1     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
[[code]]

[[code format="cpp"]]
U64 wPawnDefendedFromWest(U64 wpawns) {
   return wpawns & wPawnEastAttacks(wpawns);
}

U64 wPawnDefendedFromEast(U64 wpawns) {
   return wpawns & wPawnWestAttacks(wpawns);
}
[[code]]

[[#Defenders]]
=Defenders= 
To get the set of defenders on the fly, we use the intersection of white pawns with it's "black" attacks:
[[code]]
white pawns         defenders           defenders
                    from west           from east
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . 1 . . .     . . . . . . . .     . . . . . . . .
. . . 1 . . 1 .     . . . 1 . . . .     . . . . . . . .
. . 1 . . . . 1     . . 1 . . . . .     . . . . . . . 1
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
[[code]]

[[code format="cpp"]]
U64 wPawnDefendersFromWest(U64 wpawns) {
   return wpawns & bPawnWestAttacks(wpawns);
}

U64 wPawnDefendersFromEast(U64 wpawns) {
   return wpawns & bPawnEastAttacks(wpawns);
}
[[code]]
Otherwise, if the set of defenders was already determined (or vice versa), we can already take advantage of the unique target/source relation ship:
[[code format="cpp"]]
wPawnDefendersFromWest = wPawnDefendedFromWest >> 9;
wPawnDefendersFromEast = wPawnDefendedFromEast >> 7;
[[code]]

[[#DefendedDefenders]]
=Defended Defenders= 
Defended defenders already are the inner pawns of a at least [[Pawn chain|triple-chain]], the d5 pawn for instance:
[[code]]
white pawns         defended            defended
                    from west           from east
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . 1 . . .     . . . . 1 . . .     . . . . . . . .
. . . 1 . . 1 .     . . . 1 . . . .     . . . . . . 1 .
. . 1 . . . . 1     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .

white pawns         defenders           defenders
                    from west           from east
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . 1 . . .     . . . . . . . .     . . . . . . . .
. . . 1 . . 1 .     . . . 1 . . . .     . . . . . . . .
. . 1 . . . . 1     . . 1 . . . . .     . . . . . . . 1
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .

                    defenders and       defenders and
white pawns         defended            defended
                    from west           from east
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . 1 . . .     . . . . . . . .     . . . . . . . .
. . . 1 . . 1 .     . . . 1 . . . .     . . . . . . . .
. . 1 . . . . 1     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
[[code]]

[[#NotDefendedDefenders]] 
=Not Defended Defenders= 
Not defended defenders are the base of a [[Pawn chain|chain]] - target of opponent attacks:
[[code]]
                    not defended        not defended
white pawns         defenders           defenders
                    from west           from east
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . 1 . . .     . . . . . . . .     . . . . . . . .
. . . 1 . . 1 .     . . . . . . . .     . . . . . . . .
. . 1 . . . . 1     . . 1 . . . . .     . . . . . . . 1
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
[[code]]
[[#NotDefendingDefended]]
=Not Defending Defended= 
Defended pawns not defending other pawns are likely the peak of a [[Pawn chain|chain]].

[[code]]
                    not defending       not defending
white pawns         defended            defended
                    from west           from east
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . 1 . . .     . . . . 1 . . .     . . . . . . . .
. . . 1 . . 1 .     . . . . . . . .     . . . . . . 1 .
. . 1 . . . . 1     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
. . . . . . . .     . . . . . . . .     . . . . . . . .
[[code]]

=Forum Posts=
* [[http://www.talkchess.com/forum/viewtopic.php?t=55477|pattern coding in bitboards]] by [[Pawel Koziol]], [[CCC]], February 26, 2015 ยป [[Pawn chain]]

=What links here?=
[[include page="Defended Pawns (Bitboards)" component="backlinks" limit="10" ]]
**[[Pawn Pattern and Properties|Up one Level]]**