This commit is contained in:
Lucie 2025-05-24 18:46:01 +02:00
parent ba441cc3da
commit 8cc09e2347
1 changed files with 1 additions and 9 deletions

View File

@ -280,7 +280,7 @@ public class Board {
}
public boolean isPieceSelected() {
if (selectedX != -1 && selectedY != -1 /*&& board[selectedY][selectedX] != null*/) {
if (selectedX != -1 && selectedY != -1) {
return true;
}
return false;
@ -322,7 +322,6 @@ public class Board {
if (enPassant) {
secondPieceCoord[0] = clickedX;
secondPieceCoord[1] = clickedY;
//move.setEnPassant(enPassant);
}
playMove(move);
turns += 1;
@ -390,16 +389,10 @@ public class Board {
public boolean isHighlighted(int x, int y, Board board2) {
if (isPieceSelected()) {
//boolean king = hasPieceMoved(PieceType.King, whiteTurn, true);
//boolean rookRight = hasPieceMoved(PieceType.Rook, whiteTurn, true);
//boolean rookLeft = hasPieceMoved(PieceType.Rook, whiteTurn, false);
Piece selectedPiece = board[selectedY][selectedX];
moveCalc = new MoveCalculator(board2);
ArrayList<int[]> moves = moveCalc.getMove(selectedPiece.getType(), selectedPiece.isWhite(), selectedX, selectedY);
//this.castlingLeft = moveCalc.getCastlingLeft();
castlingRight = moveCalc.getCastlingRight();
//this.enPassantX = moveCalc.getEnPassantX();
//this.enPassantY = moveCalc.getEnPassantY();
for (int i = 0; i < moves.size(); i++) {
if (x == moves.get(i)[0] && y == moves.get(i)[1]) {
return true;
@ -484,7 +477,6 @@ public class Board {
}
public Board(Piece[][] board) {
//Piece[][] newBoard = new Piece[lineNum][colNum];
for (int i = 0; i < colNum; i++) {
for (int j = 0; j < lineNum; j++) {
piece = board[j][i];