Pawns and Files (Bitboards)

Home * Board Representation * Bitboards * Pawn Pattern and Properties * Pawns and Files

Based on pawns, files are either closed, open or half-open. Rooks prefer open files for Mobility, to eventually enter the opponent side of the board. Rooks further prefer own half-open files to attack opponent pawns if they are weak, such as backward or isolated.

=Closed Files= Closed files have at least one white and one black pawn as member. They are the intersection of both white and black filefills. See semi-closed files. U64 closedFiles(U64 wpanws, U64 bpawns) { return fileFill(wpanws) & fileFill(bpawns); }

white pawns        black pawns . . . . . . . .    . . . . . . . . . . . . . . . .     . 1 . . . 1 1 . . . . . . . . .     1 . 1 . . . . 1 . . . . . . . .     . . . 1 . . . . 1 . . . . 1 . .     . . . . . . . . . . 1 . . . . .     . . . . . . . . . 1 1 . . . 1 1     . . . . . . . . . . . . . . . .     . . . . . . . . white file fill  &  black file fill  =  closed files 1 1 1 . . 1 1 1    1 1 1 1 . 1 1 1     1 1 1 . . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1     1 1 1 . . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1     1 1 1 . . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1     1 1 1 . . 1 1 1 1 1 1 . . 1 1 1  &  1 1 1 1 . 1 1 1  =  1 1 1 . . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1     1 1 1 . . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1     1 1 1 . . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1     1 1 1 . . 1 1 1 The complement set of closed files are either the open or halfopen files. =Open Files= Open files don't have any white or black pawn as member, thus it is the intersection of the filefills complements: U64 openFiles(U64 wpanws, U64 bpawns) { return ~fileFill(wpanws) & ~fileFill(bpawns); }

white pawns        black pawns . . . . . . . .    . . . . . . . . . . . . . . . .     . 1 . . . 1 1 . . . . . . . . .     1 . 1 . . . . 1 . . . . . . . .     . . . 1 . . . . 1 . . . . 1 . .     . . . . . . . . . . 1 . . . . .     . . . . . . . . . 1 1 . . . 1 1     . . . . . . . . . . . . . . . .     . . . . . . . . ~white file fill  & ~black file fill =  open files . . . 1 1 . . .    . . . . 1 . . .     . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . .     . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . .     . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . .     . . . . 1 . . . . . . 1 1 . . .  &  . . . . 1 . . .  =  . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . .     . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . .     . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . .     . . . . 1 . . . Alternative applying De Morgan, the complement of the unions: U64 openFiles(U64 wpanws, U64 bpawns) { return ~(fileFill(wpanws) | fileFill(bpawns)); } Or we may fill the union of both pawns, but it may be smarter to rely on common subexpression to allow inter-function optimizations of inlined functions: U64 openFiles(U64 wpanws, U64 bpawns) { return ~fileFill(wpanws | bpawns); } =Half-open Files= The complements of white or black filefills are either half-open (for either color) or open. U64 halfOpenOrOpenFile(U64 gen) {return ~fileFill(gen);}

white pawns        black pawns . . . . . . . .    . . . . . . . . . . . . . . . .     . 1 . . . 1 1 . . . . . . . . .     1 . 1 . . . . 1 . . . . . . . .     . . . 1 . . . . 1 . . . . 1 . .     . . . . . . . . . . 1 . . . . .     . . . . . . . . . 1 1 . . . 1 1     . . . . . . . . . . . . . . . .     . . . . . . . . white file fill     black file fill 1 1 1 . . 1 1 1    1 1 1 1 . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1 1 1 1 . . 1 1 1     1 1 1 1 . 1 1 1 white halfopen      black halfopen or open files      or open files . . . 1 1 . . .    . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . . . . . 1 1 . . .     . . . . 1 . . . Excluding open files by relative complement (xor), leaves the half-open files with at least one opponent pawn, but no own pawn. U64 wHalfOpenFile(U64 wpawns, U64 bpanws) { return halfOpenOrOpenFile(wpawns) ^ openFiles(wpanws, bpawns); }

white halfopen                         white halfopen or open files   ^  open files       =  files . . . 1 1 . . .    . . . . 1 . . .     . . . 1 . . . . . . . 1 1 . . .     . . . . 1 . . .     . . . 1 . . . . . . . 1 1 . . .     . . . . 1 . . .     . . . 1 . . . . . . . 1 1 . . .     . . . . 1 . . .     . . . 1 . . . . . . . 1 1 . . .  ^  . . . . 1 . . .  =  . . . 1 . . . . . . . 1 1 . . .     . . . . 1 . . .     . . . 1 . . . . . . . 1 1 . . .     . . . . 1 . . .     . . . 1 . . . . . . . 1 1 . . .     . . . . 1 . . .     . . . 1 . . . . =Semi-closed Files= So far we considered following D-file closed, since both sides have one pawn on it. In fact due to captures the pawns are open, they are not member of any opponent frontspan. Thus, the file is more like eventually mutual half-open file. We need to filefill open pawns on closed files, to consider this subset. white pawns        black pawns . . . . . . . .    . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . .     . . . . . . . . . . . 1 . . . .     . . . . . . . . . . . . . . . .     . . . 1 . . . . . . . . . . . .     . . . . . . . . . . . . . . . .     . . . . . . . . . . . . . . . .     . . . . . . . . =Filesets= As mentioned, the boolean information whether a file is occupied by a pawn or not, may be stored in one byte only - a fileset. South fill and casting to BYTE aka unsigned char is sufficient: BYTE fileSet(U64 gen) {return (BYTE) soutFill(gen);} Of course we can simply restore a filefill by zero-extending the fileset to a bitboard plus applying a north-fill multiplication with the A-file. U64 filefill(BYTE fset) { U64 ff = fset; return ff * C64(0x0101010101010101); } All the mentioned file-type sets may be handled this way. The advantage with one rank as set only - beside 1/8 space in pawnhash-table - there are no wraps to consider.

Up one Level