Constructor Piece

This commit is contained in:
cleme 2025-04-10 09:54:16 +02:00
parent 970c7f540a
commit da627552b5
1 changed files with 34 additions and 15 deletions

View File

@ -1,21 +1,40 @@
package backend; package backend;
public class Piece { public class Piece {
private int x;
private int y;
private ChessPieceType type;
private boolean isWhite;
public int getX() { public Piece(int x, int y, ChessPieceType type, boolean isWhite) {
return 0; this.x = x;
} this.y = y;
this.type = type;
this.isWhite = isWhite; // true if the piece is white, false if black
}
public int getY() { public int getX() {
return 0; return x;
} }
public PieceType getType() { public int getY() {
return null; return y;
} }
public boolean isWhite() { public ChessPieceType getType() {
return false; return type;
} }
public boolean isWhite() {
return isWhite; // Returns true if the piece is white, false if black
}
}
enum ChessPieceType {
Pawn,
Rook,
Knight,
Bishop,
Queen,
King
} }