Package game
Class Sewers
java.lang.Object
game.Sewers
A sewer through which a sewer diver can move: a grid of Tile objects
with a weighted graph of all non-floor tiles.
There is an entrance to the sewer system and a ring location (which may also be the entrance).
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
An enum representing a grid direction. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
-
Method Summary
Modifier and TypeMethodDescriptionint
Return the number of columns in the grid.static Sewers
deserialize
(List<String> nodeStrList) Convert nodeStrList, which was output by serialize(), back into a Sewers.static Sewers
digExploreSewer
(int r, int c, Random rand) Return a new random sewer system with r rows, c columns, and no coins, all edges have weight 1, and there is a ring a reasonable distance from the exit.static Sewers
digGetOutSewer
(int r, int c, int currentRow, int currentCol, Random rand) Return a new random sewer system with r rows, c columns, and random coins and edge weights.entrance()
Return the node corresponding to the entrance to the sewer system.graph()
Return the set of all nodes in the graph.nodeAt
(int r, int c) Return the node at the given (r, c).int
Return the number of open floor tiles in this sewer system (this is the size of the graph).ring()
Return the ring node in this sewer system.int
rowCount()
Return the number of rows in the grid.Serialize this sewer system to a list of strings that can be written out to a file.tileAt
(int r, int c) Return the Tile information for tile (r, c).
-
Field Details
-
MAX_EDGE_WEIGHT
public static final int MAX_EDGE_WEIGHT- See Also:
-
MAX_COIN_VALUE
public static final int MAX_COIN_VALUE- See Also:
-
TASTY_VALUE
public static final int TASTY_VALUE- See Also:
-
-
Method Details
-
digExploreSewer
Return a new random sewer system with r rows, c columns, and no coins, all edges have weight 1, and there is a ring a reasonable distance from the exit. rand is the source of randomness for the sewer-system generation. -
digGetOutSewer
Return a new random sewer system with r rows, c columns, and random coins and edge weights. It is guaranteed that (currentRow, {currentCol) will be an open floor cell. rand is the source of randomness to use for the sewer-system generation. -
numOpenTiles
public int numOpenTiles()Return the number of open floor tiles in this sewer system (this is the size of the graph). -
rowCount
public int rowCount()Return the number of rows in the grid. -
columnCount
public int columnCount()Return the number of columns in the grid. -
graph
Return the set of all nodes in the graph. This is an umodifiable view of the graph. -
entrance
Return the node corresponding to the entrance to the sewer system. -
ring
Return the ring node in this sewer system. -
tileAt
Return the Tile information for tile (r, c). Requires: (r, c) must be in the grid. -
nodeAt
Return the node at the given (r, c). Requires: (r, c) must be in the grid. -
serialize
Serialize this sewer system to a list of strings that can be written out to a file. The list of strings can be converted back into a Sewers using deserialize(). -
deserialize
Convert nodeStrList, which was output by serialize(), back into a Sewers. Requires: The list of strings is of the format output by serialize().
-