U64 Bishop_classical(int indx, U64 blocker)
{
U64 attacks = 0ULL;
// North West
attacks |= RAYS[Direction::NORTH_WEST][indx];
if (RAYS[Direction::NORTH_WEST][indx] & blocker) {
unsigned long blockerIndex;
unsigned char valid = _BitScanForward64(&blockerIndex, RAYS[Direction::NORTH_WEST][indx] & blocker);
if (valid) {
attacks &= ~RAYS[Direction::NORTH_WEST][blockerIndex];
}
}
// North East
attacks |= RAYS[Direction::NORTH_EAST][indx];
if (RAYS[Direction::NORTH_EAST][indx] & blocker) {
unsigned long blockerIndex;
unsigned char valid = _BitScanForward64(&blockerIndex, RAYS[Direction::NORTH_EAST][indx] & blocker);
if (valid) {
attacks &= ~RAYS[Direction::NORTH_EAST][blockerIndex];
}
}
// South East
attacks |= RAYS[Direction::SOUTH_EAST][indx];
if (RAYS[Direction::SOUTH_EAST][indx] & blocker) {
unsigned long blockerIndex;
unsigned char valid = _BitScanReverse64(&blockerIndex, RAYS[Direction::SOUTH_EAST][indx] & blocker);
if (valid) {
attacks &= ~RAYS[Direction::SOUTH_EAST][blockerIndex];
}
}
// South West
attacks |= RAYS[Direction::SOUTH_WEST][indx];
if (RAYS[Direction::SOUTH_WEST][indx] & blocker) {
unsigned long blockerIndex;
unsigned char valid = _BitScanReverse64(&blockerIndex, RAYS[Direction::SOUTH_WEST][indx] & blocker);
if (valid) {
attacks &= ~RAYS[Direction::SOUTH_WEST][blockerIndex];
}
}
return attacks;
}