From c1e6a4614047054944dc55597cddb06c404b91bb Mon Sep 17 00:00:00 2001 From: cleme Date: Tue, 6 May 2025 16:02:23 +0200 Subject: [PATCH] highlight failed --- OOP_1A2_Project/src/backend/Board.java | 3 +-- OOP_1A2_Project/src/backend/Piece.java | 9 ++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/OOP_1A2_Project/src/backend/Board.java b/OOP_1A2_Project/src/backend/Board.java index 22598ff..b7b57ab 100644 --- a/OOP_1A2_Project/src/backend/Board.java +++ b/OOP_1A2_Project/src/backend/Board.java @@ -120,7 +120,7 @@ public class Board { } return result; } - private Piece getPieceAt(int x, int y) { + public Piece getPieceAt(int x, int y) { for (Piece p : pieces) { if (p.getX() == x && p.getY() == y) { return p; @@ -171,7 +171,6 @@ public class Board { } } - public boolean isSelected(int x, int y) { // Check if the selected coordinates match the given x and y if (selectedX != null && selectedY != null) { diff --git a/OOP_1A2_Project/src/backend/Piece.java b/OOP_1A2_Project/src/backend/Piece.java index 94b6eb3..e224343 100644 --- a/OOP_1A2_Project/src/backend/Piece.java +++ b/OOP_1A2_Project/src/backend/Piece.java @@ -1,16 +1,15 @@ package backend; - public class Piece { private int x; private int y; private PieceType type; - private boolean isWhite; + private boolean isWhite; // true if the piece is white, false if black public Piece(int x, int y, PieceType type, boolean isWhite) { this.x = x; this.y = y; this.type = type; - this.isWhite = isWhite; // true if the piece is white, false if black + this.isWhite = isWhite; } public int getX() { @@ -28,9 +27,9 @@ public class Piece { public boolean isWhite() { return isWhite; // Returns true if the piece is white, false if black } - + public void moveTo(int x, int y) { this.x = x; this.y = y; } -} \ No newline at end of file +}