|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.sidoh.wwf_api.game_state.Board
org.sidoh.wwf_api.game_state.WordsWithFriendsBoard
public class WordsWithFriendsBoard
Implements the logic and layout of the WWF play board.
| Nested Class Summary | |
|---|---|
protected static class |
WordsWithFriendsBoard.Builder
|
| Nested classes/interfaces inherited from class org.sidoh.wwf_api.game_state.Board |
|---|
Board.SlotBuilder |
| Field Summary | |
|---|---|
static int |
ALL_TILES_BONUS
Bonus applied when all tiles are used |
static java.lang.String |
BLANK_LETTER
Character used to represent a blank tile |
static int |
DIMENSIONS
Size of the board |
static java.util.Map<java.lang.Character,java.lang.Integer> |
TILE_VALUES
A map going from tile character -> # of points that tile is worth |
static java.util.List<TileBuilder> |
TILES
The tiles in the bag at the start of a game. |
static int |
TILES_PER_PLAYER
Number of tiles each player has |
| Fields inherited from class org.sidoh.wwf_api.game_state.Board |
|---|
size, storage |
| Constructor Summary | |
|---|---|
WordsWithFriendsBoard()
Use default values. |
|
WordsWithFriendsBoard(org.sidoh.wwf_api.types.game_state.BoardStorage storage)
|
|
| Method Summary | |
|---|---|
WordsWithFriendsBoard |
clone()
|
AdjacentSlots |
getAdjacentSlots(int index)
Get the slots adjacent to the specified slot. |
AdjacentSlots |
getAdjacentSlots(int row,
int column)
Get the slots adjacent to the specified slot |
static int |
getColFromIndex(int index)
|
protected static int |
getIndexFromRowAndCol(int row,
int col)
|
protected static int |
getLetterScore(org.sidoh.wwf_api.types.game_state.Slot slot,
org.sidoh.wwf_api.types.game_state.Tile tile)
Compute the score attributable to a single tile in a play, not counting word modifiers. |
static int |
getLetterValue(java.lang.String letter)
Returns the value of the provided tile. |
static int |
getRowFromIndex(int index)
|
org.sidoh.wwf_api.types.game_state.Slot |
getSlot(int index)
Return the slot located at the provided location |
org.sidoh.wwf_api.types.game_state.Slot |
getSlot(int row,
int column)
Return the slot located at the provided location |
protected static int |
getWordScore(int baseScore,
java.util.List<org.sidoh.wwf_api.types.game_state.SlotModifier> modifiers)
Apply word modifiers to a base score to determine the overall score. |
protected boolean |
hasAdjacentTiles(java.lang.Integer index,
org.sidoh.wwf_api.types.game_state.WordOrientation orientation)
Convenience method used to determine if a provided location has tiles placed next to it in a particular orientation (either vertical or horizontal) |
protected static boolean |
isWordModifier(org.sidoh.wwf_api.types.game_state.SlotModifier mod)
|
Move.Result |
move(Move move)
Makes and scores move |
protected static org.sidoh.wwf_api.types.game_state.WordOrientation |
opposite(org.sidoh.wwf_api.types.game_state.WordOrientation o)
Convenience method for swapping horizontal/vertical. |
protected Move.Result |
playWord(java.util.List<org.sidoh.wwf_api.types.game_state.Tile> _tiles,
int firstLetterRow,
int firstLetterCol,
org.sidoh.wwf_api.types.game_state.WordOrientation orientation,
boolean placeTiles)
Play a word on the board. |
Move.Result |
scoreMove(Move move)
Scores a move without actually making it |
java.lang.String |
toString()
|
| Methods inherited from class org.sidoh.wwf_api.game_state.Board |
|---|
getSlotBuilders, getSlotSafe, getStorage, hasTiles, wordsWithFriendsBoard |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int DIMENSIONS
public static final java.lang.String BLANK_LETTER
public static final java.util.List<TileBuilder> TILES
public static final java.util.Map<java.lang.Character,java.lang.Integer> TILE_VALUES
public static final int TILES_PER_PLAYER
public static final int ALL_TILES_BONUS
| Constructor Detail |
|---|
public WordsWithFriendsBoard()
public WordsWithFriendsBoard(org.sidoh.wwf_api.types.game_state.BoardStorage storage)
storage - the board| Method Detail |
|---|
public AdjacentSlots getAdjacentSlots(int row,
int column)
row - column -
public AdjacentSlots getAdjacentSlots(int index)
index - the index of the tile. row and column are determined mathematically from the index
public WordsWithFriendsBoard clone()
clone in class java.lang.Object
public org.sidoh.wwf_api.types.game_state.Slot getSlot(int row,
int column)
row - column -
public org.sidoh.wwf_api.types.game_state.Slot getSlot(int index)
getSlot in class Boardindex -
public Move.Result move(Move move)
move -
public Move.Result scoreMove(Move move)
move -
protected Move.Result playWord(java.util.List<org.sidoh.wwf_api.types.game_state.Tile> _tiles,
int firstLetterRow,
int firstLetterCol,
org.sidoh.wwf_api.types.game_state.WordOrientation orientation,
boolean placeTiles)
_tiles - the tiles to playfirstLetterRow - the row the first tile is played infirstLetterCol - the column the first tile is played inorientation - orientation of the play (either vertical or horizontal)placeTiles - if true, modify the board state
protected boolean hasAdjacentTiles(java.lang.Integer index,
org.sidoh.wwf_api.types.game_state.WordOrientation orientation)
index - location in questionorientation - vertical/horizontal
protected static int getWordScore(int baseScore,
java.util.List<org.sidoh.wwf_api.types.game_state.SlotModifier> modifiers)
baseScore - score based only on tile scores (this includes non-word modifiers)modifiers - list of word modifiers applying to a word
protected static int getLetterScore(org.sidoh.wwf_api.types.game_state.Slot slot,
org.sidoh.wwf_api.types.game_state.Tile tile)
slot - the slot the tile is to be placed intile - the tile to be played
protected static boolean isWordModifier(org.sidoh.wwf_api.types.game_state.SlotModifier mod)
mod - modifier in question
protected static org.sidoh.wwf_api.types.game_state.WordOrientation opposite(org.sidoh.wwf_api.types.game_state.WordOrientation o)
o -
public static int getRowFromIndex(int index)
index - a location on the board
public static int getColFromIndex(int index)
index - a location on the board
protected static int getIndexFromRowAndCol(int row,
int col)
row - col -
public static int getLetterValue(java.lang.String letter)
letter -
public java.lang.String toString()
toString in class java.lang.Object
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||