bugfix: GetPinningRay jumped through the board
This commit is contained in:
1 parent
054129b67b
commit
ae581e0f03
3 files changed
+11
-4
No files matched your search
+8
-1
@@ -363,7 +363,14 @@ static Bitboard GetPinningRay(Board &board, int square, int direction) {
|
||||
while (square < 64 && square >= 0) {
|
||||
int currentRank = square / 8;
|
||||
|
||||
if (abs(currentRank - previousRank) > 1) break;
|
||||
int difference = abs(currentRank - previousRank);
|
||||
|
||||
if ((abs(direction) == 7 || abs(direction) == 9)
|
||||
&& difference != 1) {
|
||||
break;
|
||||
} else if (abs(direction) == 1 && difference) {
|
||||
break;
|
||||
}
|
||||
previousRank = currentRank;
|
||||
|
||||
ray.SetBit(square);
|
||||
|
||||
Reference in new issue
Block a user