public class Cavern
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Cavern.Direction
An enum reprsenting a grid direction.
|
Modifier and Type | Field and Description |
---|---|
static int |
MAX_EDGE_WEIGHT |
static int |
MAX_GOLD_VALUE |
static int |
TASTY_VALUE |
Modifier and Type | Method and Description |
---|---|
static Cavern |
deserialize(java.util.List<java.lang.String> nodeStrList)
Convert nodeStrList into a Cavern and return it.
|
static Cavern |
digEscapeCavern(int rows,
int cols,
int currentRow,
int currentCol,
java.util.Random rand)
Return a new random Cavern of size (rows, cols) with random
gold and edge weights.
|
static Cavern |
digExploreCavern(int rows,
int cols,
java.util.Random rand)
Return a new random Cavern of size (rows, cols) with no gold.
|
int |
getColumnCount()
Return the number of columns in the grid.
|
Node |
getEntrance()
Return the node corresponding to the entrance to the cavern.
|
java.util.Set<Node> |
getGraph()
Return the set of all nodes in the graph.
|
Node |
getNodeAt(int r,
int c)
Return the node at position (r, c).
|
int |
getRowCount()
Return the number of rows in the grid.
|
Node |
getTarget()
Return the target node in this cavern.
|
Tile |
getTileAt(int r,
int c)
Return the Tile information for (r, c).
|
int |
numOpenTiles()
Return the number of open floor tiles in this cavern (this is the size of the graph).
|
java.util.List<java.lang.String> |
serialize()
Serialize this cavern as a list of strings that can be written to a file.
|
public static final int MAX_EDGE_WEIGHT
public static final int MAX_GOLD_VALUE
public static final int TASTY_VALUE
public static Cavern digExploreCavern(int rows, int cols, java.util.Random rand)
public static Cavern digEscapeCavern(int rows, int cols, int currentRow, int currentCol, java.util.Random rand)
public int numOpenTiles()
public int getRowCount()
public int getColumnCount()
public java.util.Set<Node> getGraph()
public Node getEntrance()
public Node getTarget()
public Tile getTileAt(int r, int c)
r
, c
) must be in the grid.public Node getNodeAt(int r, int c)
r
, c
) must be in the grid.public java.util.List<java.lang.String> serialize()
Cavern
using deserialize()
.public static Cavern deserialize(java.util.List<java.lang.String> nodeStrList)
serialize()
.