forked from SICTC/Wumpus
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrooms.java
More file actions
64 lines (61 loc) · 963 Bytes
/
Copy pathrooms.java
File metadata and controls
64 lines (61 loc) · 963 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
public class rooms
{
int roomNum;
boolean wumpus=false;
boolean spider=false;
boolean pit=false;
String desc;
rooms[] Adj;
public rooms(int roomNum)
{
this.roomNum = roomNum;
}
public void setAdj(rooms[] Adj)
{
this.Adj = Adj;
}
public void setDesc(String desc)
{
this.desc = desc;
}
public boolean isAdj(rooms r)
{
boolean isAdj = false;
for (int i=0;i<Adj.length;i++)
{
if(r==Adj[i])
{
isAdj=true;
}
}
return isAdj;
}
public boolean hasWumpus()
{
return wumpus;
}
public boolean hasSpider()
{
return spider;
}
public boolean hasPit()
{
return pit;
}
public void setWumpus()
{
wumpus=true;
}
public void setSpider()
{
spider=true;
}
public void setPit()
{
pit=true;
}
public String toString()
{
return desc + "\nRooms you can move to:" + " " + Adj[0].roomNum+ " " + Adj[1].roomNum + " " + Adj[2].roomNum;
}
}