-
Notifications
You must be signed in to change notification settings - Fork 0
/
Position.java
57 lines (45 loc) · 903 Bytes
/
Position.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
53
54
55
56
57
import java.util.*;
public class Position
{
private int x;
private int y;
private boolean isOpponent;
private boolean isPlaced;
public Position() {
this.x = -1;
this.y = -1;
this.isOpponent = false;
this.isPlaced = false;
}
public Position(int x, int y, boolean isOpponent) {
this.x = x;
this.y = y;
this.isOpponent = isOpponent;
this.isPlaced = true;
}
public int getX() {
return this.x;
}
public int getY() {
return this.y;
}
public int getWeight() {
if(this.isOpponent) {
return 1;
}
return 0;
}
public boolean getIsOpponent() {
return this.isOpponent;
}
public boolean isPlaced() {
// return this.x == x && this.y == y;
return this.isPlaced;
}
public boolean isTheSame(Position pos) {
return pos.isOpponent == this.isOpponent;
}
public String toString() {
return "("+this.x+", "+this.y+") opponent: "+this.isOpponent;
}
}