All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class map.MineMap

java.lang.Object
   |
   +----map.MineMap

public class MineMap
extends Object
implements Map
The class Map implements a mine map. A strategy operates on a mine map. By invoking the operations of probing and marking, the strategy attempts to place the mine map in a state in which every cell that does not contain a mine has been probed, without probing a cell that does contain a mine.

See Also:
Strategy

Method Index

 o columns()
Provide the number of columns in this mine map.
 o display()
Display the mine map on the standard output stream.
 o done()
Is this game finished? The game is finished if it has been won or if a cell with a mine has been probed.
 o look(int, int)
Look at a cell.
 o mark(int, int)
Mark a cell.
 o mines_minus_marks()
Provide the number of mines minus the number of marks in this mine map.
 o pick(int)
Pick a number at random.
 o probe(int, int)
Probe a cell for a mine.
 o rows()
Provide the number of rows in this mine map.
 o unmark(int, int)
Unmark a cell.
 o won()
Has this game been won? A game is won if every cell which does not contain a mine has been probed, but no cell with a mine has been probed.

Methods

 o pick
 public int pick(int n)
Pick a number at random.

Parameters:
n - a positive number (not checked)
Returns:
a nonnegative number less than n
 o won
 public boolean won()
Has this game been won? A game is won if every cell which does not contain a mine has been probed, but no cell with a mine has been probed.

 o done
 public boolean done()
Is this game finished? The game is finished if it has been won or if a cell with a mine has been probed.

 o probe
 public int probe(int x,
                  int y)
Probe a cell for a mine.

Parameters:
x - x coordinate of cell
y - y coordinate of cell
 o look
 public int look(int x,
                 int y)
Look at a cell.

Parameters:
x - x coordinate of cell
y - y coordinate of cell
 o mark
 public int mark(int x,
                 int y)
Mark a cell.

Parameters:
x - x coordinate of cell
y - y coordinate of cell
 o unmark
 public int unmark(int x,
                   int y)
Unmark a cell.

Parameters:
x - x coordinate of cell
y - y coordinate of cell
 o mines_minus_marks
 public int mines_minus_marks()
Provide the number of mines minus the number of marks in this mine map.

 o rows
 public int rows()
Provide the number of rows in this mine map.

 o columns
 public int columns()
Provide the number of columns in this mine map.

 o display
 public void display()
Display the mine map on the standard output stream. Used only for debugging.


All Packages  Class Hierarchy  This Package  Previous  Next  Index