Class Board

java.lang.Object
Model.gameClasses.Board

public class Board extends Object
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    This class represents every square in the board - it has a Tile and a color
  • Constructor Summary

    Constructors
    Constructor
    Description
    the board constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    Checks if a given word assignment on the board is legal
    void
    Assigning all the squares according to the given template.
    boolean
    Checks if the word is a valid word from the game dictionary
    static Board
    Gives a reference to the board - or creates it - Single Tone
    Tile[][]
    Creates a 2-D array of tiles and copy the status of the tiles in the board.
     
    getWords(Word word)
    Gets all the possible words that are created if a given word would be placed.
    void
    setTiles(Tile[][] tiles)
     
    int
    checks all the condition and tries to place the word.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Board

      public Board()
      the board constructor. Initializes the gameboard and builds it.
  • Method Details

    • getBoard

      public static Board 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

      public Tile[][] 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

      public boolean boardLegal(Word word)
      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

      public boolean dictionaryLegal(Word word)
      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

      public ArrayList<Word> getWords(Word word)
      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

      public List<Tile> getWord(String word)
    • tryPlaceWord

      public int tryPlaceWord(Word word)
      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

      public void setTiles(Tile[][] tiles)