Package nl.nuggit.words.board

Examples of nl.nuggit.words.board.Square


  }

  public void play() {
    int tilePosition = startPosition;
    for (Tile tile : tiles) {
      Square square = line.getSquares()[tilePosition];
      Tile boardTile = square.getTile();
      if (boardTile == null) {
        square.setTile(tile);
      } else if (boardTile != tile) {
        throw new IllegalStateException(String.format(
            "Tile mismatch board:%s, word:%s", boardTile, tile));
      }
      tilePosition++;
View Full Code Here


    Word word = new Word(line, position);
    int score = 0;
    int wordFactor = 1;
    for (int wordIndex = 0; wordIndex < candidate.length(); wordIndex++) {
      Character symbol = candidate.charAt(wordIndex);
      Square square = line.getSquares()[position + wordIndex];
      Tile tile = square.getTile();
      int letterValue;
      if (tile != null) {
        if (tile.getLetter().getSymbol().equals(symbol)) {
          // matching tile on the board
          boardTileUsed = true;
          word.getTiles().add(tile);
          letterValue = tile.getLetter().getValue();
        } else {
          // tile mismatch on board
          fullMatch = false;
          break;
        }
      } else {
        Letter letter = language.getLetter(symbol);
        if (trayCopy.remove(symbol)) {
          // we place a matching tile
          tilesTakenFromTray++;
          word.getTiles().add(new Tile(letter));
          Booster booster = square.getBooster();
          letterValue = letter.getValue();
          if (booster != null) {
            letterValue = letterValue * booster.letterFactor();
            wordFactor = wordFactor * booster.wordFactor();
          }
 
View Full Code Here

TOP

Related Classes of nl.nuggit.words.board.Square

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.