java.lang.Object
Model.gameClasses.Board
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThis class represents every square in the board - it has a Tile and a color -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanboardLegal(Word word) Checks if a given word assignment on the board is legalvoidAssigning all the squares according to the given template.booleandictionaryLegal(Word word) Checks if the word is a valid word from the game dictionarystatic BoardgetBoard()Gives a reference to the board - or creates it - Single ToneTile[][]getTiles()Creates a 2-D array of tiles and copy the status of the tiles in the board.Gets all the possible words that are created if a given word would be placed.voidinttryPlaceWord(Word word) checks all the condition and tries to place the word.
-
Constructor Details
-
Board
public Board()the board constructor. Initializes the gameboard and builds it.
-
-
Method Details
-
getBoard
Gives a reference to the board - or creates it - Single Tone- Returns:
- returns the state of the board
-
buildBoard
public void buildBoard()Assigning all the squares according to the given template. -
getTiles
Creates a 2-D array of tiles and copy the status of the tiles in the board.- Returns:
- a 2D array of the tiles in the board.
-
boardLegal
Checks if a given word assignment on the board is legal- Parameters:
word- a given word to check whether we can place it on the board- Returns:
- if the word placement is legal or not
-
dictionaryLegal
Checks if the word is a valid word from the game dictionary- Parameters:
word- - to check if it is a valid word- Returns:
- if the word is valid or not.
-
getWords
Gets all the possible words that are created if a given word would be placed.- Parameters:
word- a given word that the user might place.- Returns:
- a list of words that are created by the given word.
-
getWord
-
tryPlaceWord
checks all the condition and tries to place the word.- Parameters:
word- a word that the user tries to place.- Returns:
- return the score by placing that word (0 if didn't succeed).
-
setTiles
-