-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBlackChecker.java
52 lines (35 loc) · 1 KB
/
BlackChecker.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
47
48
49
50
51
52
package com.company;
import javax.swing.ImageIcon;
import java.net.URL;
public class BlackChecker extends CheckerPosition {
public BlackChecker(Coordinate c) {
checkerState = new NormalStateBlack();
position = c;
value = BLACK_VALUE_NORMAL;
stringRep = "X";
}
public int getColor() {
return BLACK;
}
public void makeKing() {
checkerState = new KingState();
value = BLACK_VALUE_KING;
stringRep = "B";
}
public boolean isKing() {
return (value == BLACK_VALUE_KING);
}
public boolean kingRow() {
return ( (position.get() >= 29) && (position.get() <= 32) );
}
public CheckerPosition copy() {
CheckerPosition newChecker = new BlackChecker(position);
if (value == BLACK_VALUE_KING)
newChecker.makeKing();
return newChecker;
}
@Override
public ImageIcon getIcon() {
return null;
}
}