-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathTiger.java
More file actions
64 lines (53 loc) · 1.12 KB
/
Copy pathTiger.java
File metadata and controls
64 lines (53 loc) · 1.12 KB
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
58
59
60
61
62
63
64
class Tiger {
int owner;
int ID;
TigerStatusEnum status;
Location location;
Tiger(){
this.owner = -1;
this.status = TigerStatusEnum.onNone;
this.location = new Location(-1,-1);
this.ID = 0;
}
Tiger(int owner, int ID){
this.owner = owner;
this.status = TigerStatusEnum.onNone;
this.location = new Location(-1, -1);
this.ID = ID;
}
void updateLocation(Location location){
this.location = location;
}
void setStatus(int newStatus){
this.status = convertIntToMeepleStatus(newStatus);
}
void setStatus(TigerStatusEnum newStatus){
this.status = newStatus;
}
int getOwner(){
return owner;
}
Location getLocation() { return location; }
TigerStatusEnum getStatus(){
return status;
}
private TigerStatusEnum convertIntToMeepleStatus (int status){
switch (status) {
case 0:
return TigerStatusEnum.onJungle;
case 1:
case 4:
return TigerStatusEnum.onTrail;
case 2:
case 3:
case 5:
return TigerStatusEnum.onLake;
case 6:
return TigerStatusEnum.onDen;
case 9:
return TigerStatusEnum.onNone;
default:
throw new IllegalStateException();
}
}
}