advancement on knight but still doesnt work

This commit is contained in:
hugomanipoud2 2025-05-21 18:06:24 +02:00
parent 7526532ea4
commit 9c740ee1f0
1 changed files with 13 additions and 5 deletions

View File

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