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 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.
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:
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 filefillopen pawns on closed files, to consider this subset.
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:
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.
Table of Contents
File Types
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 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.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:Alternative applying De Morgan , the complement of the unions:
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:
Half-open Files
The complements of white or black filefills are either half-open (for either color) or open.Excluding open files by relative complement (xor), leaves the half-open files with at least one opponent pawn, but no own pawn.
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.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: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.
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.
What links here?
Up one Level