diff --git a/OOP_1A2_Project/bin/backend/Board$Position.class b/OOP_1A2_Project/bin/backend/Board$Position.class deleted file mode 100644 index 63e1cab..0000000 Binary files a/OOP_1A2_Project/bin/backend/Board$Position.class and /dev/null differ diff --git a/OOP_1A2_Project/bin/backend/Board.class b/OOP_1A2_Project/bin/backend/Board.class index 3924584..8050728 100644 Binary files a/OOP_1A2_Project/bin/backend/Board.class and b/OOP_1A2_Project/bin/backend/Board.class differ diff --git a/OOP_1A2_Project/src/backend/Board.java b/OOP_1A2_Project/src/backend/Board.java index 9a7bde7..15327c4 100644 --- a/OOP_1A2_Project/src/backend/Board.java +++ b/OOP_1A2_Project/src/backend/Board.java @@ -59,7 +59,7 @@ public class Board { Piece p = pieces.get(i); if (p.getX() == x && p.getY() == y) { pieces.remove(i); - break; + i = pieces.size(); } } Piece newPiece = new Piece(x, y, type, isWhite); @@ -72,7 +72,7 @@ public class Board { Piece p = pieces.get(i); if (p.getX() == x && p.getY() == y) { pieces.remove(i); - break; + i = pieces.size(); } } } @@ -189,6 +189,10 @@ public class Board { if (move.isValid()) { move.execute(); + // Play the move sound + Sound.getInstance().playMoveSound(); + + // Check for checkmate if (move.putsOpponentInCheckmate()) { System.out.println("Checkmate! " + (isWhiteTurn ? "Black" : "White") + " wins!"); @@ -256,7 +260,9 @@ public class Board { } for (int y = 0; y < height; y++) { - if (y >= array.length) break; + if (y >= array.length) { + y = height; + }else { String line = array[y]; String[] squares = line.split(","); @@ -274,6 +280,7 @@ public class Board { pieces.add(new Piece(x, y, type, isWhite)); } } + } if (array.length > height) { String turnInfo = array[height]; @@ -360,6 +367,9 @@ public class Board { public void playMove(Move move) { if (move.isValid() && !move.putsOwnKingInCheck()) { move.execute(); + + // Play the move sound + Sound.getInstance().playMoveSound(); } } } \ No newline at end of file