public class Cavern
extends java.lang.Object
| Modifier and Type | Class and Description |
|---|---|
static class |
Cavern.Direction
An enum representing 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, which was output by
serialize(), back into a Cavern. |
static Cavern |
digEscapeCavern(int rows,
int cols,
int currentRow,
int currentCol,
java.util.Random rand)
Return a new random cavern with random gold and edge weights.
|
static Cavern |
digExploreCavern(int rows,
int cols,
java.util.Random rand)
Return a new random cavern of the given size where there is no gold, all
edges have weight 1, and there is an orb a reasonable distance from the exit.
|
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 the given (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 tile (r, c).
|
int |
numOpenTiles()
Returns 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 to a list of strings which can be written out 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)
rows - The number of rows in this cavern.cols - The number of columns in this cavern.rand - A source of randomness to use for the cavern generation.public static Cavern digEscapeCavern(int rows, int cols, int currentRow, int currentCol, java.util.Random rand)
currentRow, currentCol) will be an open floor cell.rows - The number of rows in this cavern.cols - The number of columns in this cavern.currentRow - The row of the cell that must be open floor.currentCol - The column of the cell that must be open floor.rand - A source of randomness to use for the cavern generation.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(), back into a Cavern.
Precondition: The list of strings is of the format output by serialize().