-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChessPiece.java
More file actions
43 lines (37 loc) · 1.16 KB
/
ChessPiece.java
File metadata and controls
43 lines (37 loc) · 1.16 KB
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
//CONNECTIONS
public abstract class ChessPiece {
private String type;
protected String color;
protected boolean hasMoved;
protected int score;
public ChessPiece(String type,String color,int score) {
this.type = type;
this.color = color;
this.hasMoved = false;
this.score = score;
}
public String getType(ChessPiece piece){
return piece.type;
}
public void setType(String type){
this.type = type;
}
public String getColor(){
return this.color;
}
public void setHasMoved(boolean didMove){
this.hasMoved=didMove;
}
public boolean getHasMoved(ChessPiece piece){
return piece.hasMoved;
}
public void setColor(String color){
this.color = color;
}
public int getScore() {
return score;
}
// Abstract method for validating moves, to be implemented in subclasses
public abstract boolean isValidMove(int startRow, int startCol, int endRow, int endCol, ChessPiece[][] board);
public abstract boolean isMoveValidWithoutChangingState(int startRow, int startCol, int endRow, int endCol, ChessPiece[][] board);
}