Index
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form
A
- actionPerformed(ActionEvent) - Method in class gui.OptionsPanel
-
When showSeed button clicked, print the seed in the console.
- add(E, double) - Method in interface datastructures.PQueue
-
Effect: Add e with priority p to the priority queue.
- add(E, double) - Method in class datastructures.SlowPQueue
- allNodes() - Method in class game.GameState
- allNodes() - Method in interface game.ScramState
-
Return a collection containing all the nodes in the graph.
- animating - Variable in class gui.GUI
-
Whether the GUI is doing an animation
B
- bestPath(Vertex) - Method in class graph.ShortestPaths
-
Returns: the best path from the source vertex to a given target vertex.
C
- cast(Maybe<U>) - Static method in class cms.util.maybe.Maybe
-
Convert a
Maybe<U>
to aMaybe<T>
, whenT
is a supertype ofU
. - changePhaseLabel(String) - Method in class gui.OptionsPanel
-
Change phase label to s.
- changePriority(E, double) - Method in interface datastructures.PQueue
-
Effect: Change the priority of element e to p.
- changePriority(E, double) - Method in class datastructures.SlowPQueue
- cms.util - package cms.util
-
Utilities originally developed for the CMS (CMSX) project.
- cms.util.maybe - package cms.util.maybe
-
Support for the type
Maybe<T>
- coins() - Method in class game.Tile
-
Return the value of coins on this Tile.
- col() - Method in class gui.DiverSprite
-
Return the diver's column on the grid.
- column() - Method in class game.Tile
-
Return the column of this Tile.
- columnCount() - Method in class game.Sewers
-
Return the number of columns in the grid.
- compareTo(NodeStatus) - Method in class game.NodeStatus
-
If the distances of this and other are equal, return neg, 0 or pos depending on whether this id is less than, equal to, or greater than other's id.
- create() - Method in exception cms.util.FastException
-
Create a FastException
- create() - Method in exception cms.util.maybe.NoMaybeValue
- currentLocation() - Method in class game.GameState
-
Return the unique id of the current location.
- currentLocation() - Method in interface game.SeekState
-
Return the unique identifier associated with McDiver's current location.
- currentNode() - Method in class game.GameState
- currentNode() - Method in interface game.ScramState
-
Return the Node corresponding to McDiver's location in the graph.
- customFillInStackTrace() - Method in exception cms.util.FastException
-
Effect: Fill in the stack trace like a normal (expensive) exception.
D
- datastructures - package datastructures
-
Useful data structures for the McDiver application.
- deserialize(List<String>) - Static method in class game.Sewers
-
Convert nodeStrList, which was output by serialize(), back into a Sewers.
- dest(E) - Method in interface graph.DirectedGraph
-
The destination vertex for an edge in the graph.
- dest(Edge) - Method in class game.Maze
- destination() - Method in class game.Edge
-
Return destination of edge
- digExploreSewer(int, int, Random) - Static method in class game.Sewers
-
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.
- digGetOutSewer(int, int, int, int, Random) - Static method in class game.Sewers
-
Return a new random sewer system with r rows, c columns, and random coins and edge weights.
- DirectedGraph<V,
E> - Interface in graph -
This is a constraint interface for a directed graph of type G, with vertices of type V and edges of type E.
- direction() - Method in enum class game.Sewers.Direction
-
Return the direction of this instance
- displayError(String) - Method in class gui.GUI
-
Display error e to the player.
- distanceToRing() - Method in class game.GameState
-
Return the Manhattan distance from the current location to the ring location on the map.
- distanceToRing() - Method in interface game.SeekState
-
Return McDiver's current distance along the grid (NOT THE GRAPH) from the ring.
- diver - package diver
-
The place for your diver algorithm.
- diver - Variable in class gui.GUI
-
The panel for updating and drawing the diver
- DiverSprite - Class in gui
-
Responsible for managing the sewer diver and drawing it on the screen.
- DiverSprite(int, int, GUI) - Constructor for class gui.DiverSprite
-
Constructor: an instance starting at (startRow, startCol), created for gui.
E
- EAST - Enum constant in enum class game.Sewers.Direction
- Edge - Class in game
-
An Edge represents an immutable directed, weighted edge.
- Edge(Edge, Map<Node, Node>) - Constructor for class game.Edge
-
Constructor: an edge that is isomorphic to iso.
- Edge(Node, Node, int) - Constructor for class game.Edge
-
Constructor: an edge from src to dest with length length.
- entrance - Variable in class gui.MazePanel
-
Images representing entrance at beginning and a man emerging from hole
- entrance() - Method in class game.Sewers
-
Return the node corresponding to the entrance to the sewer system.
- ENTRANCE - Enum constant in enum class game.Tile.TileType
- equals(Object) - Method in class game.Node
-
Return true iff ob is a Node with the same id as this one.
- equals(Object) - Method in class game.NodeStatus
-
Return true iff ob is a NodeStatus with the same id as this one.
- exit() - Method in class game.GameState
- exit() - Method in interface game.ScramState
-
Return the Node associated with the exit from the sewer system.
- exitEnd - Variable in class gui.MazePanel
-
Images representing entrance at beginning and a man emerging from hole
- extractMin() - Method in interface datastructures.PQueue
-
Effect: Remove (and return) the element of the priority queue with highest priority.
- extractMin() - Method in class datastructures.SlowPQueue
F
- FastException - Exception in cms.util
-
An exception that is fast to throw but doesn't have very good debugging support unless its withStackTrace() method is used explicitly.
- FastException() - Constructor for exception cms.util.FastException
-
Initialize a FastException
- fillInStackTrace() - Method in exception cms.util.FastException
-
There is no meaningful stack trace for this exception because it is supposed to always be handled.
- finishAnimating() - Method in class gui.GUI
- FLOOR - Enum constant in enum class game.Tile.TileType
- FRAMES_PER_MOVE - Static variable in class gui.GUI
-
Frame rate of game (fps) and frames a single move takes
- FRAMES_PER_SECOND - Static variable in class gui.GUI
-
Frame rate of game (fps) and frames a single move takes
- from(T) - Static method in class cms.util.maybe.Maybe
-
Create a Maybe from a possibly null value v.
- fromOptional(Optional<T>) - Static method in class cms.util.maybe.Maybe
-
Create a
Maybe
from anOptional
value.
G
- game - package game
-
The game logic and implementation of the game controller
- GAME_HEIGHT_PROP - Static variable in class gui.GUI
-
Width and height of the game portion (proportion of total)
- GAME_WIDTH_PROP - Static variable in class gui.GUI
-
Width and height of the game portion (proportion of total)
- GameState - Class in game
-
The game controller.
- get() - Method in class cms.util.maybe.Maybe
-
Returns the contained value, if present.
- getCoinIcon(Node) - Method in class gui.GUI
-
Return an icon for the coins on tile n, or null if no coins.
- getCoinsIcon(Node) - Method in class gui.MazePanel
-
Return an icon for the coins on tile n, or null if no coins.
- getDistance(Vertex) - Method in class graph.ShortestPaths
-
Returns: the distance from the source vertex to the given vertex.
- getDistanceToRing() - Method in class game.NodeStatus
-
Return the distance to the ring from the Node that corresponds br>to this NodeStatus.
- getEdge(Node) - Method in class game.Node
-
Return the Edge of this Node that connects to Node q.
- getExits() - Method in class game.Node
-
Return an unmodifiable view of the Edges leaving this Node.
- getIcon(Tile.TileType) - Method in class gui.GUI
-
Return an image representing tile type.
- getIcon(Tile.TileType) - Method in class gui.MazePanel
-
Return an image representing tile type type.
- getId() - Method in class game.Node
-
Return the unique Identifier of this Node.
- getId() - Method in class game.NodeStatus
-
Return the Id of the Node that corresponds to this NodeStatus.
- getMazePanel() - Method in class gui.GUI
-
Return the MazePanel associated with this GUI.
- getNeighbors() - Method in class game.Node
-
Return an unmodifiable view of the Nodes neighboring this Node.
- getOptional(Optional<T>) - Static method in class cms.util.maybe.Maybe
-
Get the value in an
Optional
, if present; otherwise throw the checked exceptionNoMaybeValue
. - getOptionsPanel() - Method in class gui.GUI
-
Return the OptionsPanel associated with this GUI.
- getOther(Node) - Method in class game.Edge
-
Return the Node on this Edge that is not equal to n.
- getSprite(int, int) - Method in class gui.Sprite
-
Return offset (dRow, dCol) into the spritesheet.
- getTile() - Method in class game.Node
-
Return the Tile corresponding to this Node.
- graph - package graph
-
Graph algorithms and interfaces
- graph() - Method in class game.Sewers
-
Return the set of all nodes in the graph.
- gui - package gui
-
Graphical user interface for the McDiver application
- GUI - Class in gui
-
An instance is a GUI for the game.
- GUI(Sewers, int, int, long, GameState) - Constructor for class gui.GUI
-
Constructor: a new display for sewer system with the diver at
(diverRow, diverCol) using random number seed seed and overseen by GameState gs. - GUIControl - Class in game
-
Methods for controlling the interaction between the main thread and the GUI, if a GUI is present.
H
- hashCode() - Method in class game.Node
- hashCode() - Method in class game.NodeStatus
I
- isAnimating() - Method in class gui.GUI
- isEmpty() - Method in interface datastructures.PQueue
-
Returns: true iff the priority queue is empty.
- isEmpty() - Method in class datastructures.SlowPQueue
- isPresent() - Method in class cms.util.maybe.Maybe
-
Returns whether a value is contained in this
Maybe
. - iterator() - Method in class cms.util.maybe.Maybe
-
Provide an iterator that yields either one
T
or none, depending.
L
- length - Variable in class game.Edge
-
The length of this edge
- length() - Method in class game.Edge
-
Return the length of this
Edge
M
- main(String[]) - Static method in class game.Main
-
The main program.
- Main - Class in game
-
The main program for the McDiver application.
- Main() - Constructor for class game.Main
- MAX_BONUS - Static variable in class game.GameState
-
Minimum and maximum bonuses
- MAX_COIN_VALUE - Static variable in class game.Sewers
- MAX_COLS - Static variable in class game.GameState
-
minimum and maximum number of columns
- MAX_EDGE_WEIGHT - Static variable in class game.Sewers
- MAX_ROWS - Static variable in class game.GameState
-
minimum and maximum number of rows
- Maybe<T> - Class in cms.util.maybe
-
An object that may contain a value of type
T
. - Maybe() - Constructor for class cms.util.maybe.Maybe
-
Do nothing.
- Maze - Class in game
-
A Maze is a weighted directed graph of game.Node and game.Edge objects
- Maze(Set<Node>) - Constructor for class game.Maze
-
Creates: a maze from a set of Nodes.
- mazePanel - Variable in class gui.GUI
-
The panel for generating and drawing the maze
- MazePanel - Class in gui
-
An instance is responsible for drawing the underlying maze on the screen.
The MazePanel should contain only static images that don't need to change
unless the screen is redrawn. - MazePanel(Sewers, int, int, GUI) - Constructor for class gui.MazePanel
-
Create a new MazePanel of a given size.
- McDiver - Class in diver
-
This is the place for your implementation of the
SewerDiver
. - McDiver() - Constructor for class diver.McDiver
- MIN_BONUS - Static variable in class game.GameState
-
Minimum and maximum bonuses
- MIN_COLS - Static variable in class game.GameState
-
minimum and maximum number of columns
- MIN_ROWS - Static variable in class game.GameState
-
minimum and maximum number of rows
- moveTo(long) - Method in class game.GameState
-
See moveTo(Node<TileData> n)
- moveTo(long) - Method in interface game.SeekState
-
Change McDiver's current location to the node given by id.
- moveTo(Node) - Method in class game.GameState
-
Attempt to move the sewerDiver from the current position to the
Node n
. - moveTo(Node) - Method in interface game.ScramState
-
Change McDiver's location to n.
- moveTo(Node) - Method in class gui.DiverSprite
-
Tell the diver to move from its current location to node dst.
- moveTo(Node) - Method in class gui.GUI
-
Move the diver on the GUI to destination dest, and block until the diver has completed the move.
N
- neighbors() - Method in class game.GameState
-
Return a collection of NodeStatus objects that contain the unique ID of the node and the distance from that node to the ring.
- neighbors() - Method in interface game.SeekState
-
Return an unordered collection of NodeStatus objects associated with all direct neighbors of McDiver's current location.
- Node - Class in game
-
An instance is a node of the graph
- nodeAt(int, int) - Method in class game.Sewers
-
Return the node at the given (r, c).
- NodeStatus - Class in game
-
Status of a graph node
- NoMaybeValue - Exception in cms.util.maybe
-
A checked exception that forces the programmer to handle the possibility of empty maybes.
- NoMaybeValue() - Constructor for exception cms.util.maybe.NoMaybeValue
- none() - Static method in class cms.util.maybe.Maybe
-
Returns an empty
Maybe
. - NORTH - Enum constant in enum class game.Sewers.Direction
- numOpenTiles() - Method in class game.Sewers
-
Return the number of open floor tiles in this sewer system (this is the size of the graph).
O
- options - Variable in class gui.GUI
-
The panel for showing stats / displaying options
- OptionsPanel - Class in gui
-
An instance is a JPanel with info for the user,
including a slider to speed up McDiver's movements. - OptionsPanel(int, int, int, int, long) - Constructor for class gui.OptionsPanel
-
Constructor: an instance is a JPanel with top-left corner (x, y), width width,
height height, and random number seed seed --which was used t generate the graph. - orElse(T) - Method in class cms.util.maybe.Maybe
-
Returns the contained value, if any; otherwise, returns
other
. - orElseGet(Supplier<T>) - Method in class cms.util.maybe.Maybe
-
Returns the contained value, if any; otherwise, returns
other.get()
. - orElseMaybe(Supplier<Maybe<T>>) - Method in class cms.util.maybe.Maybe
-
Returns this if a value is contained; otherwise, returns
other.get()
. - orElseThrow(E) - Method in class cms.util.maybe.Maybe
-
Returns the contained value, if any; otherwise, throws the specified exception.
- originalCoinValue() - Method in class game.Tile
-
Return the original amount of coins on this tile.
- outgoingEdges(Node) - Method in class game.Maze
- outgoingEdges(V) - Method in interface graph.DirectedGraph
-
All outgoing edges from a vertex in the graph
P
- paintComponent(Graphics) - Method in class gui.DiverSprite
-
Draw the diver on its own panel.
- paintComponent(Graphics) - Method in class gui.MazePanel
-
Draw the maze on the screen.
- paintComponent(Graphics) - Method in class gui.OptionsPanel
-
Paint the component
- paintComponent(Graphics) - Method in class gui.TileSelectPanel
-
Paint this component using page.
- paintEntranceExit(Graphics, int, int) - Method in class gui.MazePanel
-
If tile (row, col) is the entrance/exit, draw the graphic for it.
- peek() - Method in interface datastructures.PQueue
-
Returns: the element of the priority queue with highest priority, without changing the priority queue.
- peek() - Method in class datastructures.SlowPQueue
- PQueue<E> - Interface in datastructures
-
A priority queue containing distinct elements of type E, with priorities represented as values of type
double
.
R
- ring() - Method in class game.Sewers
-
Return the ring node in this sewer system.
- RING - Enum constant in enum class game.Tile.TileType
- row() - Method in class game.Tile
-
Return the row of this Tile.
- row() - Method in class gui.DiverSprite
-
Return the diver's row on the grid.
- rowCount() - Method in class game.Sewers
-
Return the number of rows in the grid.
- runNewGame(long, boolean, SewerDiver) - Static method in class game.GameState
-
Given seed, whether to use the GUI, and an instance of a solution, run the game using that solution.
S
- scram(ScramState) - Method in class diver.McDiver
-
See
SewerDriver
for specification. - scram(ScramState) - Method in interface diver.SewerDiver
-
Scram --get out of the sewer system before the steps are all used, trying to collect as many coins as possible along the way.
- ScramState - Interface in game
-
A ScramState provides all the information necessary to get out of the sewer system and collect coins on the way.
- scramSucceeded() - Method in class game.GameState
-
= "scram succeeded"
- SCREEN_HEIGHT - Static variable in class gui.GUI
-
Width and height of the entire screen
- SCREEN_WIDTH - Static variable in class gui.GUI
-
Width and height of the entire screen
- seek(SeekState) - Method in class diver.McDiver
-
See
SewerDriver
for specification. - seek(SeekState) - Method in interface diver.SewerDiver
-
Find the ring in as few steps as possible.
- SeekState - Interface in game
-
The state of the game while finding the ring.
- selectNode(Node) - Method in class gui.GUI
-
Select node n on the GUI.
This displays information on that node's panel on the screen. - selectNode(Node) - Method in class gui.TileSelectPanel
-
Select node n on the GUI.
- serialize() - Method in class game.Sewers
-
Serialize this sewer system to a list of strings that can be written out to a file.
- setLighting(boolean) - Method in class gui.GUI
-
Set the sewer system to be all light or all dark, depending on light.
- setLighting(boolean) - Method in class gui.MazePanel
-
Set the sewers to be all light (light = true) or all dark.
- setVisited(int, int) - Method in class gui.MazePanel
-
Update the GUI to inform it that tile (row, col) was visited.
- SewerDiver - Interface in diver
-
The interface a sewer diver must implement in order to be used in solving the game.
- Sewers - Class in game
-
A sewer through which a sewer diver can move: a grid of Tile objects with a weighted graph of all non-floor tiles.
- Sewers.Direction - Enum Class in game
-
An enum representing a grid direction.
- ShortestPaths<Vertex,
Edge> - Class in graph -
This object computes and remembers shortest paths through a weighted, directed graph.
- ShortestPaths(WeightedDigraph<Vertex, Edge>) - Constructor for class graph.ShortestPaths
-
Creates: a single-source shortest-path finder for a weighted graph.
- singleSourceDistances(Vertex) - Method in class graph.ShortestPaths
-
Effect: Computes the best paths from a given source vertex, which can then be queried using bestPath().
- size() - Method in interface datastructures.PQueue
-
Returns: the number of elements in the priority queue.
- size() - Method in class datastructures.SlowPQueue
- SlowPQueue<E> - Class in datastructures
-
A slow implementation of a priority queue where the priorities are doubles.
- SlowPQueue() - Constructor for class datastructures.SlowPQueue
-
Creates: an empty queue
- some(T) - Static method in class cms.util.maybe.Maybe
-
Creates a
Maybe
from a non-null argument. - source() - Method in class game.Edge
-
Return the source of this edge.
- source(E) - Method in interface graph.DirectedGraph
-
The source vertex for an edge in the graph.
- source(Edge) - Method in class game.Maze
- SOUTH - Enum constant in enum class game.Sewers.Direction
- sprite() - Method in class gui.DiverSprite
-
Return the image representing the current state of the diver.
- Sprite - Class in gui
-
An instance maintains information about a sprite for the GUI.
- Sprite(String, int, int, int) - Constructor for class gui.Sprite
-
Constructor: an instance with image at imageLoc, of size (width, height), and number of frames in the animation cycleSize.
- startAnimating() - Method in class gui.GUI
- startAnimation(Maybe<GUI>) - Static method in class game.GUIControl
-
Register that an animation is starting on the GUI, if the GUI is present.
- stepsToGo() - Method in class game.GameState
- stepsToGo() - Method in interface game.ScramState
-
Return the steps remaining to get out of the sewer system.
T
- takeCoins() - Method in class game.Tile
-
Set the value of coins on this Node to 0 and return the amount "taken"
- TASTY_VALUE - Static variable in class game.Sewers
- theException - Static variable in exception cms.util.maybe.NoMaybeValue
- then(Function<T, U>) - Method in class cms.util.maybe.Maybe
-
If a value
v
is present, returns aMaybe
containingf(v)
, which must be non-null. - thenDo(Consumer<T>) - Method in class cms.util.maybe.Maybe
-
Call
cons
on the contained value, if any. - thenElse(Consumer<T>, Runnable) - Method in class cms.util.maybe.Maybe
-
If a value is contained, run consThen on the value; otherwise run procElse
- thenMaybe(Function<T, Maybe<U>>) - Method in class cms.util.maybe.Maybe
-
If a value
v
is present, returnsf(v)
. - tick() - Method in class gui.Sprite
-
Update the spritesheet's animation by a single frame.
- Tile - Class in game
-
A tile on the game board.
- Tile(int, int, int, Tile.TileType) - Constructor for class game.Tile
-
Constructor: an instance with row r, column c, coin-value cv, and Type t.
- TILE_HEIGHT - Static variable in class gui.MazePanel
-
The width and height (in pixels) of a tile on the grid
- TILE_WIDTH - Static variable in class gui.MazePanel
-
The width and height (in pixels) of a tile on the grid
- Tile.TileType - Enum Class in game
-
An enum representing the different types of Tiles that
may appear in a sewer system. - tileAt(int, int) - Method in class game.Sewers
-
Return the Tile information for tile (r, c).
- TileSelectPanel - Class in gui
-
An instance is a panel that displays information about a currently selected Tile.
- TileSelectPanel(int, int, int, int, GUI) - Constructor for class gui.TileSelectPanel
-
Constructor: an instance at (x, y) with size (width, height) on Gui gui.
- toOptional() - Method in class cms.util.maybe.Maybe
-
Create an
Optional
from aMaybe
- toString() - Method in interface datastructures.PQueue
-
Returns a string that represents this priority queue:
[item0:priority0, item1:priority1, ..., item(N-1):priority(N-1)]
That is, the list is delimited by '[' and ']', and items are separated by ", " (a comma and a space). - toString() - Method in class game.Tile
- type() - Method in class game.Tile
-
Return the TileType of this Tile.
U
- updateBonus(double) - Method in class gui.GUI
-
Update the bonus multiplier as displayed by the GUI by bonus
- updateBonus(double) - Method in class gui.OptionsPanel
-
Update bonus multiplier b as displayed by the GUI
- updateCoins(int, int) - Method in class gui.GUI
-
Update the number of coins picked up as displayed on the GUI.
- updateCoins(int, int) - Method in class gui.OptionsPanel
-
Update the number of coins c picked up as displayed on the GUI.
Score is the current player's score. - updateLoc(int, int, int, int) - Method in class gui.TileSelectPanel
-
Update the location to (x, y) with size (width, height)
of this element (for instance, on screen resize). - updateMaxStepsLeft(int) - Method in class gui.OptionsPanel
-
Update the maximum number of steps left, m, for this stage.
- updateSewer(Sewers, int) - Method in class gui.GUI
-
What is the specification?
- updateStepsLeft(int) - Method in class gui.OptionsPanel
-
Update the steps t left as displayed on the GUI.
- updateStepsToGo(int) - Method in class gui.GUI
-
Update the steps remaining as displayed on the GUI to stepsLeft.
- usage() - Static method in class game.Main
-
Effect: Prints a usage message.
V
- valueOf(String) - Static method in enum class game.Sewers.Direction
-
Returns the enum constant of this class with the specified name.
- valueOf(String) - Static method in enum class game.Tile.TileType
-
Returns the enum constant of this class with the specified name.
- values() - Static method in enum class game.Sewers.Direction
-
Returns an array containing the constants of this enum class, in the order they are declared.
- values() - Static method in enum class game.Tile.TileType
-
Returns an array containing the constants of this enum class, in the order they are declared.
W
- waitForAnimation(Maybe<GUI>) - Static method in class game.GUIControl
-
Wait until the GUI animation, if any, is complete.
- WALL - Enum constant in enum class game.Tile.TileType
- weight(E) - Method in interface graph.WeightedDigraph
-
The weight of an edge
- weight(Edge) - Method in class game.Maze
- WeightedDigraph<V,
E> - Interface in graph -
Constraint interface for a directed graph with edge weights.
- WEST - Enum constant in enum class game.Sewers.Direction
- withStackTrace() - Method in exception cms.util.FastException
-
Effect: fills in the stack trace of this exception.
All Classes and Interfaces|All Packages|Constant Field Values|Serialized Form