-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChessPiece.java
More file actions
45 lines (35 loc) · 912 Bytes
/
Copy pathChessPiece.java
File metadata and controls
45 lines (35 loc) · 912 Bytes
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
public class ChessPiece {
protected int value;
protected String name;
protected boolean isAlive;
protected boolean isWhite;
protected boolean hasMoved;
public ChessPiece(int val, String piece, boolean isWhite){
this.value = val;
this.name = piece;
this.isAlive = true;
this.isWhite = isWhite;
this.hasMoved = false;
}
public void hasMoved(){
this.hasMoved = true;
}
public boolean getMoved(){
return hasMoved;
}
public void Remove(){
this.isAlive = false;
}
public int getValue(){
return value;
}
public boolean getColor(){
return isWhite;
}
public String getName(){
return name;
}
public int compareColor(ChessPiece c){
return Boolean.compare(this.getColor(), c.getColor());
}
}