35 lines
746 B
Java
35 lines
746 B
Java
package backend;
|
|
|
|
public class Piece {
|
|
private int x;
|
|
private int y;
|
|
private PieceType type;
|
|
private boolean isWhite;
|
|
|
|
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
|
|
}
|
|
|
|
public int getX() {
|
|
return x;
|
|
}
|
|
|
|
public int getY() {
|
|
return y;
|
|
}
|
|
|
|
public PieceType getType() {
|
|
return type;
|
|
}
|
|
|
|
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;
|
|
}
|
|
} |