forked from JoeMeas/ChessGame
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathChessPiece.java
46 lines (37 loc) · 894 Bytes
/
ChessPiece.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* Created by Perry on 8/8/2014.
*/
public abstract class ChessPiece {
public boolean alive;
protected int posX;
protected int posY;
public ChessPiece(int posX, int posY){
this.alive = true;
this.posX = posX;
this.posY = posY;
}
public void move(int newX, int newY){
this.posX = newX;
this.posY = newY;
}
public void move(final PositionTuple position) {
move(position.x, position.y);
}
public void move(final String destination) {
final PositionTuple position = new PositionTuple(destination);
move(position);
}
public void kill(){
this.alive = false;
}
public boolean isAlive(){
return this.alive;
}
public int getPosX() {
return posX;
}
public int getPosY() {
return posY;
}
public String toString;
}