-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChess.java
More file actions
41 lines (32 loc) · 841 Bytes
/
Copy pathChess.java
File metadata and controls
41 lines (32 loc) · 841 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
package objects;
import java.awt.*;
import java.io.Serializable;
public class Chess implements Serializable {
public int row;
public int column;
Color color;
public Chess(int row, int column, Color color) {
this.row = row;
this.column = column;
this.color = color;
}
public Chess(int row, int column, int color) {
this.row = row;
this.column = column;
if (color==0){
this.color=Color.black;
}else if (color==1){
this.color=Color.white;
}
}
public boolean equal(Chess obj) {
return row == obj.row && column == obj.column;
}
@Override
public String toString() {
return "[" + row + "," + column + "," + color + "]";
}
public Color getColor() {
return this.color;
}
}