xr_a_y wrote: ↑Sat Jul 06, 2019 10:35 pm
Gerd Isenberg wrote: ↑Sat Jul 06, 2019 10:26 pm
You are right. The routine should exclude rams:
Code: Select all
U64 wBackward(U64 wpawns, U64 bpawns) {
U64 stops = (wpawns << 8) & ~bpawns;
U64 wAttackSpans = wEastAttackFrontSpans(wpawns)
| wWestAttackFrontSpans(wpawns);
U64 bAttacks = bPawnEastAttacks(bpawns)
| bPawnWestAttacks(bpawns);
return (stops & bAttacks & ~wAttackSpans) >> 8;
}
Thanks for the clarification
After thinking a bit, I would suggest to keep the routine as it was - to determine pawns with a permanent weakened stop square (stop is not member of own front-attackspans but controlled by a sentry) - to exclude further subsets later. Not only rammed pawns, but with mutual backwardness to exclude the more advanced - here f5 and h5, even without the rams f6, h6, are mutual backward due to the real straggler on g7 (halfopen backward on rank 2,3 aka 7,6), but more advanced and therefor not considered backward in the Kmoch sense of definition: "If two opposing pawns on adjacent files in knight distance are mutually backward, the more advanced is not considered backward".
However to assign exactly what penalties for what degrees of backwardness inside a chess program is an other issue. Stragglers (halfopen on rank 2,3) are surely the worst instance of backward pawns. Other pawn sets with weak stops/telestops or frontspans may receive a small penalty if not considered elsewhere, i.e. as member of levers (qsearch), rammed or isolated pawns.