still trying for knight

This commit is contained in:
hugomanipoud2 2025-05-21 18:20:43 +02:00
parent 9c740ee1f0
commit 4ab757eec9
1 changed files with 6 additions and 8 deletions

View File

@ -227,16 +227,16 @@ public class Move {
public boolean isKnightMoveValid(int x, int y, boolean color, int selectX, int selectY) {
if(board.getPiece(selectX + 1, selectY + 2) != null) {
if (color != board.getPiece(selectX + 1, selectY + 2).isWhite()) {
if (selectX == x + 1 && selectY == y + 2) {
if (selectX == x + 1 && selectY == y + 2) {
if(board.getPiece(selectX + 1, selectY + 2) != null) {
if(color != board.getPiece(selectX+ 1, selectY + 2).isWhite()) {
return true;
}
}
if (selectX == x + 1 && selectY == y + 2) {
return true;
}
if (selectX == x - 1 && selectY == y - 2) {
@ -273,8 +273,6 @@ public class Move {
return true;
}
}
return false;
}
}