added getQueenAttack function

This commit is contained in:
rektdie committed 2024-03-26 08:15:34 +01:00
1 parent bd6690d168
commit 3bc75f843f
2 files changed
+17 -1

No files matched your search

+15
View File
@@ -256,4 +256,19 @@ Bitboard getRookAttack(int square, U64 occupancy) {
occupancy >>= (64 - rookRelevantBits[square]);
return rookAttacks[square][occupancy];
}
Bitboard getQueenAttack(int square, U64 occupancy) {
U64 bishopOccupancy = occupancy;
U64 rookOccupancy = occupancy;
bishopOccupancy &= bishopMasks[square].GetBoard();
bishopOccupancy *= bishopMagicNumbers[square];
bishopOccupancy >>= (64 - bishopRelevantBits[square]);
rookOccupancy &= rookMasks[square].GetBoard();
rookOccupancy *= rookMagicNumbers[square];
rookOccupancy >>= (64 - rookRelevantBits[square]);
return rookAttacks[square][rookOccupancy] | bishopAttacks[square][bishopOccupancy];
}