-
Notifications
You must be signed in to change notification settings - Fork 0
/
Square.java
55 lines (44 loc) · 1.03 KB
/
Square.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
package com.company;
public class Square {
private Board b;
private boolean visited;
private Piece occupyingPiece;
private int xNum;
private int yNum;
public Square(Board b, boolean visited, int xNum, int yNum) {
this.b = b;
this.visited = visited;
this.xNum = xNum;
this.yNum = yNum;
}
public Piece getOccupyingPiece() {
return occupyingPiece;
}
public boolean isVisited(){
return visited;
}
public void setVisited(){
this.visited = true;
}
public int getXNum() {
return this.xNum;
}
public int getYNum() {
return this.yNum;
}
public void put(Piece p) {
this.occupyingPiece = p;
p.setPosition(this);
}
public void remove() {
this.occupyingPiece = null;
}
/*@Override
public int hashCode() {
int prime = 31;
int result = 1;
result = prime * result + xNum;
result = prime * result + yNum;
return result;
}*/
}