Class Cave

java.lang.Object
  extended by Cave

public class Cave
extends java.lang.Object

Class that models a cave in "Hunt the Wumpus"

Version:
4/4/17
Author:
Dave Reed

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, or "unknown" if yet to be visited.
 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).
 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

Cave

public Cave(java.lang.String name,
            int num,
            int adj1,
            int adj2,
            int adj3)
Constructs a cave with the specified characteristics. By default, the cave is unvisited and empty.

Parameters:
name - the name of the cave
num - the cave number
adj1 - number of the first adjacent cave
adj2 - number of the second adjacent cave
adj3 - number of the third adjacent cave
Method Detail

getAdjNumber

public int getAdjNumber(int tunnel)
Accesses the number of an adjacent cave.

Parameters:
tunnel - the tunnel number (1-3)
Returns:
the number of the adjacent cave through that tunnel

getCaveName

public java.lang.String getCaveName()
Accesses the name of the cave, or "unknown" if yet to be visited.

Returns:
the cave name or "unknown"

getCaveNumber

public int getCaveNumber()
Accesses the number of the cave.

Returns:
the cave number

getContents

public CaveContents getContents()
Accesses the contents of the contents (CaveContents.EMPTY, CaveContents.WUMPUS, CaveContents.BATS, or CaveContents.PIT).

Returns:
the cave contents

markAsVisited

public void markAsVisited()
Marks the cave as having been visited.


setContents

public void setContents(CaveContents contents)
Sets the contents of the cave (CaveContents.EMPTY, CaveContents.WUMPUS, CaveContents.BATS, or CaveContents.PIT).

Parameters:
contents - the new contents