added getQueenAttack function
This commit is contained in:
1 parent
bd6690d168
commit
3bc75f843f
2 files changed
+17
-1
No files matched your search
@@ -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];
|
||||
}
|
||||
Reference in new issue
Block a user