The fill up/down idea was introduced by Steffan Westcott.
The same guy who recently posted the enumeration all subsets of a set algorithm in CCC:
- Code: Select all
subset = 0;
do {
// do something with subset
subset = (subset - set) & set;
} while (subset);
The parallel prefix Kogge-Stone routine
- Code: Select all
BB _NorthFill(BB gen) {
gen |= (gen << 8);
gen |= (gen << 16);
gen |= (gen << 32);
return gen;
}
is identical to the occluded fill with empty board propagator (pro == -1, no blockers).
- Code: Select all
BB _NorthOccl(BB gen, BB pro) {
gen |= pro & (gen << 8);
pro = pro & (pro << 8);
gen |= pro & (gen << 16);
pro = pro & (pro << 16);
gen |= pro & (gen << 32);
return gen;
}
To get half-isolanis, candidates etc. it makes sense to compute and keep (for a while) six span-sets for all white and black pawns:
Front-span and back-span of all pawns,
front-span and back-span of "east" pawn attacks, and
front-span and back-span of "west" pawn attacks.
This is also nice to get sets of files with halfopen and open-properties.
Those sets might be ored if needed for passed pawns.
A pawn which intersects opposite front-spans is mechanically blocked, otherwise open. A pawn which intersects opposite attacks or front-spans of those attacks has opposite guards and is also not passed even if open. Only if the intersection of a pawn with all front-attacks-spans is empty the pawn becomes a passer.
Particular nice, specially for pawn-endings, is to have precalculated sets of all "squares of the king", indexed by square index of the opposite king and side to move (for the tempo). Thus one needs only one "and" to get a set of all passers "outside the king square".
Gerd