-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStateWolf.java
More file actions
37 lines (29 loc) · 978 Bytes
/
StateWolf.java
File metadata and controls
37 lines (29 loc) · 978 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
public class StateWolf
{
int wolfArray[];
public StateWolf(int[] wolfArray) { this.wolfArray = wolfArray; }
public StateWolf(StateWolf state) {
wolfArray = new int[8];
for(int i=0; i<8; i++)
this.wolfArray[i] = state.wolfArray[i];
}
public boolean equals(Object o)
{
StateWolf state = (StateWolf) o;
for (int i=0; i<8; i++)
if (this.wolfArray[i] != state.wolfArray[i])
return false;
return true;
}
public int hashCode() {
return wolfArray[0]*10000000 + wolfArray[1]*1000000 + wolfArray[2]*100000 +
wolfArray[3]*10000 + wolfArray[4]*1000 + wolfArray[5]*100+wolfArray[6]*10+wolfArray[7];
}
public String toString()
{
String ret = "";
for (int i=0; i<8; i++)
ret += " " + this.wolfArray[i];
return ret;
}
}