-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
74 lines (57 loc) · 1.34 KB
/
Player.java
File metadata and controls
74 lines (57 loc) · 1.34 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
import java.util.ArrayList;
import java.util.List;
public abstract class Player{
protected ChessColor color;
private int score;
private King king;
public boolean isCheck;
public boolean isCheckMate;
public Player(ChessColor color){
this.color = color;
isCheck = false;
isCheckMate = false;
score = 0;
}
public ChessColor getColor(){
return color;
}
public int getScore(){
return score;
}
public void addToScore(int value){
score = score + value;
}
public void removeFromScore(int value){
score = score - value;
}
public abstract FromTo getFromTo(GameUI ui);
public Piece getKing(){
return king;
}
public void setKing(King king){
this.king = king;
}
public boolean isCheckMate(Board board){
return false;
}
public void setCheck(){
isCheck = true;
}
public void setCheckMate() {
isCheckMate = true;
}
public void unSetCheck(){
isCheck = false;
}
public List<Move> getAllMoves(Board board) {
List<Move> list = new ArrayList<>();
for (Piece piece : board.getPieces(this)) {
list.addAll(piece.getAllMoves(board));
}
return list;
}
@Override
public String toString(){
return null;
}
}