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
+16

No files matched your search

+15
View File
@@ -257,3 +257,18 @@ Bitboard getRookAttack(int square, U64 occupancy) {
return rookAttacks[square][occupancy]; 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];
}
+1
View File
@@ -213,3 +213,4 @@ void initSliderAttacks();
Bitboard getBishopAttack(int square, U64 occupancy); Bitboard getBishopAttack(int square, U64 occupancy);
Bitboard getRookAttack(int square, U64 occupancy); Bitboard getRookAttack(int square, U64 occupancy);
Bitboard getQueenAttack(int square, U64 occupancy);