|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.ObjectBoard
This class creates a board for a given ScrabbleBuilder.
Class also provides methods for operating on the board.
Method placeMove is called by g.endTurn() and is key to
validating a player's Move.
Game,
Move,
LetterMove| Constructor Summary | |
Board(ScrabbleBuilder b)
Constructs a board given a ScrabbleBuilder b as input. |
|
Board(Square[][] arr)
Constructs a board given a Square array arr as input. |
|
| Method Summary | |
java.lang.Object |
clone()
Clones the current board. |
java.util.ArrayList |
getRow(int y)
Returns a row of squares as an ArrayList. |
Square |
getSquare(int i,
int j)
Gets a square on the board at a given i, j. |
java.util.List |
getSquares()
Returns all squares as a List. |
boolean |
isOccupied(int x,
int y)
Returns a boolean stating whether a specified square is occupied or not (ie whether it has a letter placed on it or not). |
boolean |
occupiedAdjacent(int x,
int y)
Returns a boolean stating whether a specified occupied square i, j is adjacent to any other occupied squares. |
void |
placeLetter(Letter l,
int x,
int y)
Method to place a given letter on the board on a specific i, j square. |
boolean |
placeMove(Move m,
Board oldboard)
Returns a boolean stating whether a specified Move. |
void |
resetMoveSquares(Move m)
Resets a given Move's used squares. |
java.lang.String |
toString()
Returns a String representation of a square. |
boolean |
validateMove(Move m,
int numb)
Returns a boolean after receiving a boolean from m.validateMove(numb). |
| Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public Board(ScrabbleBuilder b)
b - The ScrabbleBuilder of the current game.public Board(Square[][] arr)
arr - The Square array to be processed.| Method Detail |
public java.lang.Object clone()
public Square getSquare(int i,
int j)
i - The i co-ordinate on the board of the required square.j - The j co-ordinate on the board of the required square.
public java.util.ArrayList getRow(int y)
y - The y co-ordinate of the row you'd like to return.
public java.util.List getSquares()
public boolean isOccupied(int x,
int y)
x - The x co-ordinate of the square you'd like to test.y - The y co-ordinate of the square you'd like to test.
public boolean occupiedAdjacent(int x,
int y)
x - The x co-ordinate of the square you'd like to test.y - The y co-ordinate of the square you'd like to test.
public boolean validateMove(Move m,
int numb)
m - The Move you'd like to validate.numb - The type of validation you'd like.
public boolean placeMove(Move m,
Board oldboard)
m - The Move you'd like to place.oldboard - The Board you'd like it to be placed on.
public void resetMoveSquares(Move m)
m - The Move you'd like to be reset.
public void placeLetter(Letter l,
int x,
int y)
l - The Letter you'd like to place.x - The x co-ordinate of the square you'd like to place a letter.y - The y co-ordinate of the square you'd like to place a letter.public java.lang.String toString()
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||