The origional code in Senpai:
Code: Select all
static Bit piece_attacks(Square from, Bit tos, Bit pieces) {
for (Bit b = tos & Blocker[from] & pieces; b != 0; b = rest(b)) {
Square to = first(b);
tos &= ~Beyond[from][to];
}
return tos;
}
My idea (Check always the rest attacks):
Code: Select all
static Bit piece_attacks(Square from, Bit tos, Bit pieces) {
for (Bit b = tos & Blocker[from] & pieces; b != 0; b = rest(b) & tos) {
Square to = first(b);
tos &= ~Beyond[from][to];
}
return tos;
}
- Tamás