|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This interface defines the Minesweeper board. This is meant to be an immutable data structure, only providing methods for data access.
Method Summary | |
int |
getCount(int x,
int y)
Returns the number of mines surrounding the target cell. |
int |
getCount(java.awt.Point p)
Returns the number of mines surrounding the target cell. |
java.util.Set |
getEdge()
Returns an immutable set containing Point objects representing the edge of the Minesweeper board. |
java.util.Set |
getFringe()
Returns an immutable set containing Point objects representing the fringe of the Minesweeper board. |
int |
getHeight()
Returns the height of the Minesweeper board |
java.awt.Point |
getLastMove()
Returns the move that was last made on the board; returns null if no moves have been made |
int |
getMines()
Retunrs the total number of mines in the Minesweeper board |
java.util.Set |
getNeighbors(int x,
int y)
Returns an immutable set containing Point objects representing the neighbors of the target cell. |
java.util.Set |
getNeighbors(java.awt.Point p)
Returns an immutable set containing Point objects representing the neighbors of the target cell. |
int |
getOpenedCount()
Returns the number of opened cells on the board; the return value will be in the range of 0 inclusive and getWidth() * getHeight() inclusive. |
int |
getWidth()
Returns the width of the Minesweeper board |
boolean |
inBounds(int x,
int y)
Returns boolean indicating whether the target cell is in bounds of this Minesweeper board |
boolean |
inBounds(java.awt.Point p)
Returns boolean indicating whether the target cell is in bounds of this Minesweeper board |
boolean |
isOpened(int x,
int y)
Returns a boolean indicating whether the target cell has been opened yet. |
boolean |
isOpened(java.awt.Point p)
Returns a boolean indicating whether the target cell has been opened yet. |
void |
print()
Prints a text representation of the board to System.out |
Method Detail |
public int getHeight()
public int getWidth()
public int getMines()
public boolean inBounds(int x, int y)
x
- x-coordinate of the target cell; between 0 inclusive and
getWidth()
-1 inclusivey
- y-coordinate of the target cell; between 0 inclusive and
getHeight()
-1 inclusive
inBounds(Point)
public boolean inBounds(java.awt.Point p)
p
- coordinates of the target cell; between (0,0) inclusive and (getWidth()
-1,
getHeight()
-1) inclusive
inBounds(int, int)
public int getCount(int x, int y)
inBounds(int, int)
of
isOpened(int, int)
return false for the target cell.
x
- The x coordinate of the target celly
- The y coordinate of the target cell
inBounds(int, int)
of isOpened(int, int)
return
false for the target cellgetCount(Point)
,
isOpened(int, int)
,
inBounds(int, int)
public int getCount(java.awt.Point p)
inBounds(Point)
of
isOpened(Point)
return false for the target cell.
p
- The x-y-coordinates of the target cell
inBounds(Point)
of isOpened(Point)
return false
for the target cellgetCount(int, int)
,
isOpened(Point)
,
inBounds(Point)
public boolean isOpened(int x, int y)
inBounds(int, int)
returns
false for the target cell.
x
- The x-coordinate of the target celly
- The y-coordinate of the target cell
inBounds(int, int)
returns false for the
target cellisOpened(Point)
,
inBounds(int, int)
public boolean isOpened(java.awt.Point p)
inBounds(Point)
returns false
for the target cell.
p
- The x-y-coordinates of the target cell
inBounds(Point)
returns false for the
target cellisOpened(int, int)
,
inBounds(Point)
public java.util.Set getNeighbors(int x, int y)
inBounds(int, int)
returns
false for the target cell.
x
- The x-coordinate of the target celly
- The y-coordinate of the target cell
inBounds(int, int)
returns false for the target cellgetNeighbors(Point)
,
inBounds(int, int)
public java.util.Set getNeighbors(java.awt.Point p)
inBounds(Point)
returns false
for the target cell.
p
- The x-y-coordinates of the target cell
inBounds(Point)
returns
false for the target cellgetNeighbors(int, int)
,
inBounds(Point)
public java.util.Set getFringe()
public java.util.Set getEdge()
public java.awt.Point getLastMove()
public int getOpenedCount()
getWidth()
* getHeight()
inclusive.
public void print()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |