as the moovepool of the queen is one of a rook and bishop combined, an

or operator does the trick !
QUeen finished
This commit is contained in:
hugomanipoud2 2025-05-21 17:33:30 +02:00
parent d62bdf7ad0
commit 7b01772895
1 changed files with 1 additions and 9 deletions

View File

@ -252,15 +252,7 @@ public class Board {
isAPieceHere = move.isRookMoveValid(x, y, color, selectX, selectY);
} else if (type == PieceType.Queen) {
for(int i = 1; i < 8;i++) {
if(selectX == x+i && selectY == y || selectX == x && selectY == y+i ||
selectX == x-i && selectY == y || selectX == x && selectY == y-i ||
selectX == x+i && selectY == y+i || selectX == x-i && selectY == y-i ||
selectX == x-i && selectY == y+i || selectX == x+i && selectY == y-i) {
isAPieceHere = true;
}
}
isAPieceHere = (move.isBishopMoveValid(x, y, color, selectX, selectY) || move.isRookMoveValid(x, y, color, selectX, selectY));
} else if (type == PieceType.Knight) {