java.lang.Object Cave
public class Cave
Class that models a cave in "Hunt the Wumpus"
Constructor Summary | |
---|---|
Cave(java.lang.String name,
int num,
int adj1,
int adj2,
int adj3)
Constructs a cave with the specified characteristics. |
Method Summary | |
---|---|
int |
getAdjNumber(int tunnel)
Accesses the number of an adjacent cave. |
java.lang.String |
getCaveName()
Accesses the name of the cave. |
int |
getCaveNumber()
Accesses the number of the cave. |
CaveContents |
getContents()
Accesses the contents of the contents (CaveContents.EMPTY, CaveContents.WUMPUS, CaveContents.BATS, or CaveContents.PIT). |
boolean |
hasBeenVisited()
Determines whether this cave has been vistied previously. |
void |
markAsVisited()
Marks the cave as having been visited. |
void |
setContents(CaveContents contents)
Sets the contents of the cave (CaveContents.EMPTY, CaveContents.WUMPUS, CaveContents.BATS, or CaveContents.PIT). |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Cave(java.lang.String name, int num, int adj1, int adj2, int adj3)
name
- the name of the cavenum
- the cave numberadj1
- the number of the adjacent cave (through tunnel 1)adj2
- the number of the adjacent cave (through tunnel 2)adj3
- the number of the adjacent cave (through tunnel 3)Method Detail |
---|
public int getAdjNumber(int tunnel)
tunnel
- the tunnel numbers (1-3)
public java.lang.String getCaveName()
public int getCaveNumber()
public CaveContents getContents()
public boolean hasBeenVisited()
public void markAsVisited()
public void setContents(CaveContents contents)
contents
- the new contents