the code is so spaghetti but it WORKS, need to add docstrings and finish

all pieces
This commit is contained in:
hugomanipoud2 2025-05-21 14:05:06 +02:00
parent e99013d05e
commit f3be5c6f6c
1 changed files with 15 additions and 10 deletions

View File

@ -268,18 +268,23 @@ public class Board {
} }
} k = 8; } k = 8;
for (int i = 1; i < k; i++) { for (int i = 1; i < k; i++) {
if (getPiece(selectX + i, selectY - i) != null && color != getPiece(selectX + i, selectY - i).isWhite()) { if (getPiece(selectX + i, selectY - i) != null) {
k = i+1; if (color != getPiece(selectX + i, selectY - i).isWhite()) {
break; k = i+1;
}else{ if (selectX + i == x && selectY - i == y) {
k = i; isAPieceHere = true;
break; }
} break;
}
if (selectX + k == x && selectY - k == y) { }else{
k = i;
break;
}
}
if (selectX + i == x && selectY - i == y) {
isAPieceHere = true; isAPieceHere = true;
} }
}
} else if (type == PieceType.Rook) { } else if (type == PieceType.Rook) {
for(int i = 1; i < 8;i++) { for(int i = 1; i < 8;i++) {