move
This commit is contained in:
parent
fe0bcf52c6
commit
1ed4de95f5
|
|
@ -1,5 +1,25 @@
|
||||||
package backend;
|
package backend;
|
||||||
|
|
||||||
public class Move {
|
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; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,21 +1,32 @@
|
||||||
package backend;
|
package backend;
|
||||||
|
|
||||||
public class Piece {
|
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() {
|
public int getX() {
|
||||||
return 0;
|
return x;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getY() {
|
public int getY() {
|
||||||
return 0;
|
return y;
|
||||||
}
|
}
|
||||||
|
|
||||||
public PieceType getType() {
|
public PieceType getType() {
|
||||||
return null;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isWhite() {
|
public boolean isWhite() {
|
||||||
return false;
|
return isWhite;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue