Double+and+Triple+(Bitboards)


 * Home * Board Representation * Bitboards * Pawn Pattern and Properties * Double and Triple**

toc =By Square= Working in the **square centric world** of the board implies using a square index of one particular pawn, likely from bitboard traversal.

For doubled (twins) or multiple pawns on a file, we simply intersect the file-mask by own-pawns and perform a population count. This symmetrical property appears to be equal for white and black pawns, except for the before- and behind semantic. code format="cpp" wPawnsOnFile = arrFiles[sqOfWhitePawn] & pawnBB[white]; if ( wPawnsOnFile & (wPawnsOnFile-1) ) -> white pawn is a least double pawn if ( wPawnsOnFile & arrNortRay[sqOfWhitePawns] ) -> white pawn has own pawn ahead if ( wPawnsOnFile & arrSoutRay[sqOfWhitePawns] ) -> white pawn has own pawn behind code

code arrFiles[d*] . . . 1 . . . . . . . 1 . . . . . . . 1 . . . . . . . 1 . . . . . . . 1 . . . . . . . 1 . . . . . . . 1 . . . . . . . 1 . . . . code The arrFiles might be condensed to eight bitboards only, instead of 64 - if we index by code file(sq) == sq & 7 code instead of square.  =Multiple Pawns= Working in the **bitboard centric world** to determine pawn related pattern set-wise.

All pawns that are member of the rearspan of all own pawns, have at least one pawn in front on the same file. All pawns that are member of the frontspan of all own pawns, have at least one pawn behind on the same file. code format="cpp" // pawns with at least one pawn in front on the same file U64 wPawnsBehindOwn(U64 wpawns) {return wpawns & wRearSpans(wpawns);}

// pawns with at least one pawn behind on the same file U64 wPawnsInfrontOwn (U64 wpawns) {return wpawns & wFrontSpans(wpawns);} code Obviously, since each pawn in front of a pawn implies this pawn behind, the number of pawns in front is equal the number of pawns behind. code format="cpp" popCount(wPawnsBehindOwn) == popCount(wPawnsInfrontOwn) code The intersection of both sets implies at least a triple, thus a pawn in front and behind. code format="cpp" U64 wPawnsInfrontAndBehindOwn (U64 wpawns) { return wPawnsInfrontOwn(wpawns) & wPawnsBehindOwn(wpawns); } code If the intersection is empty on a file, it is a double pawn or a twin. code format="cpp" fileWithAtLeastTriple = fileFill(infrontAndBehindOwn); rearTwin = behindOwn  & ~fileWithAtLeastTriple; frontTwin = infrontOwn & ~fileWithAtLeastTriple; code

=Forum Posts=
 * [|Doubled and Backward Pawn Engine "Definitions"] by Brian Richardson, CCC, September 07, 2009
 * [|Doubled pawns] by Stefano Gemma, CCC, May 11, 2016

=What links here?= include page="Double and Triple (Bitboards)" component="backlinks" limit="20"
 * Up one Level**