This commit is contained in:
PIRANUT_PHLANG 2025-05-06 16:52:46 +02:00
parent fe0bcf52c6
commit 1ed4de95f5
2 changed files with 35 additions and 4 deletions

View File

@ -1,5 +1,25 @@
package backend;
public class Move {
private Piece pieceMoved;
private int fromX, fromY;
private int toX, toY;
private Piece pieceCaptured; // can be null
public Move(Piece pieceMoved, int fromX, int fromY, int toX, int toY, Piece pieceCaptured) {
this.pieceMoved = pieceMoved;
this.fromX = fromX;
this.fromY = fromY;
this.toX = toX;
this.toY = toY;
this.pieceCaptured = pieceCaptured;
}
public Piece getPieceMoved() { return pieceMoved; }
public int getFromX() { return fromX; }
public int getFromY() { return fromY; }
public int getToX() { return toX; }
public int getToY() { return toY; }
public Piece getPieceCaptured() { return pieceCaptured; }
}

View File

@ -1,21 +1,32 @@
package backend;
public class Piece {
private boolean isWhite;
private PieceType type;
private int x;
private int y;
public Piece(boolean isWhite, PieceType type, int x, int y) {
this.isWhite = isWhite;
this.type = type;
this.x = x;
this.y = y;
}
public int getX() {
return 0;
return x;
}
public int getY() {
return 0;
return y;
}
public PieceType getType() {
return null;
return type;
}
public boolean isWhite() {
return false;
return isWhite;
}
}