|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--agentland.games.boggle.Board
Represents the abstract Boggle board and its current state. A Boggle Board has 16 6-sided dice with letters, and a grid such that one letter faces up at any given time. Letters are distributed randomly.
Serializable
, Serialized FormConstructor Summary | |
Board()
Creates a new default Board instance. |
|
Board(int rows,
int cols)
Creates a new Board instance. |
|
Board(int rows,
int cols,
Collection letters)
Creates a new Board instance. |
Method Summary | |
int |
columns()
Get number of columns in this instantiation of Board . |
String |
getLetter(Coordinate coord)
Tell which letter is visible at the given board position. |
String |
getLetter(int x,
int y)
Tell which letter is visible at the given board position. |
Collection |
letters()
Get the Collection of letters that the board has stored in
its alphabet. |
int |
rows()
Get number of rows in this instantiation of Board . |
void |
shake()
This method does just what you might think...Scramble the board so that the getLetter methods will return different values than
before shaking. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Board()
Board
instance.
By default the size of the board is 4x4 and the letters used are
A-Z, except that Q is replaced by Qu and treated as a single letter.public Board(int rows, int cols)
Board
instance.
This instantiation uses the same set of default letters, but allows the
user to specify the number of rows and columns that the bgoard contains.rows
- number of rows the abstract board is to have.cols
- number of columns the abstract board is to have.public Board(int rows, int cols, Collection letters)
Board
instance.
This instantiation allows the user to set the number of rows and columns
that the board contatins, as well as specify the letters to use. A letter
is actually any String
, but it is highly recommended that
user-defined strings are short, so that they are properly displayed in the GUI.rows
- number of rows the abstract board is to have.cols
- number of columns the abstract board is to have.letters
- the Collection
of letters to select from randomly.Method Detail |
public int rows()
Board
.public int columns()
Board
.public Collection letters()
Collection
of letters that the board has stored in
its alphabet.public String getLetter(int x, int y)
x
- x-component of the desired coordinate.y
- y-component of the desired coordinate.public String getLetter(Coordinate coord)
coord
- the desired coordinate.public void shake()
getLetter
methods will return different values than
before shaking. Typically, a game of Boggle is initialized by shaking a
board and allowing the dice to settle in the grid.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |