Examples of BoardCase


Examples of pdp.scrabble.game.BoardCase

     * @param last
     */
    private int calculateWordPoints(
      boolean isVert, int axis, int first, int last) {

  BoardCase boardCase = null;
  Letter letter = null;
  int wordMult = 1, score = 0, letterValue = 0;

  // Check from first letter to last
  for (int index = first; index <= last; index++) {
      if (isVert) {
    boardCase = this.getCase(index, axis);
      }
      else {
    boardCase = this.getCase(axis, index);
      }

      letter = boardCase.getLetter();
      letterValue = letter.getValue();

      // Apply bonus if not already used
      if (!boardCase.getMultUsed()) {
    letterValue *= boardCase.getLetterMult();
    wordMult *= boardCase.getWordMult();
    boardCase.setMultUsed(true);
      }

      score += letterValue;
  }

View Full Code Here

Examples of pdp.scrabble.game.BoardCase

  this.droppedLetters = 0;
    }


    public void cancel(Player player) {
  BoardCase boardCase = null;
  int len = this.newCases.size();
  for (int i = 0; i < len; i++) {
      boardCase = this.newCases.get(i);

      // Give letter back to the player
      boardCase.getLetter().setJokerChar(Bag.NON_JOKER);
      if (player != null) {
    player.getRack().addLetter(boardCase.getLetter());
      }

      // Remove the letter from the board
      this.resetCase(boardCase.getV(), boardCase.getH());
  }

  this.newCases.clear();
    }
View Full Code Here

Examples of pdp.scrabble.game.BoardCase

  this.newCases.clear();
    }


    public void switchCasesLetter(int v1, int h1, int v2, int h2) {
  BoardCase case1 = this.getCase(v1, h1);
  BoardCase case2 = this.getCase(v2, h2);

  Letter letter1 = case1.getLetter();
  Letter letter2 = case2.getLetter();

  BoardCaseState state1 = case1.getState();
  BoardCaseState state2 = case2.getState();

  if (state1 == FREE) {
      int len = this.newCases.size();
      for (int i = 0; i < len; i++) {
    BoardCase boardCase = this.newCases.get(i);
    if (boardCase == case2) {
        this.newCases.set(i, case1);
        break;
    }
      }
View Full Code Here

Examples of pdp.scrabble.game.BoardCase

  root.addContent(element);

  Iterator<BoardCase> it = this.newCases.iterator();

  while (it.hasNext()) {
      BoardCase boardCase = it.next();
      boardCase.save(element);
  }
  this.newCases.clear();
    }
View Full Code Here

Examples of pdp.scrabble.game.BoardCase

  board.setDictionary(this.dictionary);
  board.setData(this.centerUsed, this.points, this.length, this.words);

  for (int v = 0; v < VERT_DIM; v++) {
      for (int h = 0; h < HORI_DIM; h++) {
    BoardCase boardCase = this.getCase(v, h).clone();
    board.setCase(v, h, boardCase);
      }
  }

  return board;
View Full Code Here

Examples of pdp.scrabble.game.BoardCase

      Display.error("Client", "Error while starting game !");
  }
    }

    public void update(Observable o, Object arg) {
  BoardCase c = (BoardCase) arg;
  try {
      this.server.sendLetter(this, c.getLetter(), c.getV(), c.getH());
  }
  catch (RemoteException ex) {
  }
    }
View Full Code Here

Examples of pdp.scrabble.game.BoardCase

  catch (RemoteException ex) {
  }
    }

    public void getLetter(Letter letter, int v, int h) throws RemoteException {
  BoardCase boardCase = this.mainFrame.getGameEnv().board().getCase(v, h);
  boardCase.setLetter(letter);
  boardCase.setState(BoardCaseState.OLD);
  boardCase.setMultUsed(true);
  this.mainFrame.repaint();
    }
View Full Code Here

Examples of pdp.scrabble.game.BoardCase

     * @param verticalCase board vertical case.
     * @param horizontalCase board horizontal case.
     */
    private void cancelLetterOnBoard(Player player, int vertCase, int horiCase) {
  if (player != null) {
      BoardCase boardCase = this.board.getCase(vertCase, horiCase);
      if (boardCase.getState() == NEW) {

    Debug.console("cancelLetterOnBoard", "remove",
            Debug.formatLetter(boardCase.getLetter()) + " at "
            + Debug.formatCoord(vertCase, horiCase));

    // Give letter back
    boardCase.getLetter().setJokerChar(Bag.NON_JOKER);
    player.getRack().addLetter(boardCase.getLetter());

    // Remove letter on board
    this.board.resetCase(vertCase, horiCase);
    this.board.removeCaseNew(boardCase);
    if (this.board.numberOfNewCases() == 0) {
View Full Code Here

Examples of pdp.scrabble.game.BoardCase

    /** Switch selected letter on board.
     * @param verticalCase board vertical case.
     * @param horizontalCase board horizontal case.
     */
    private void switchLetterOnBoard(int vertCase, int horiCase) {
  BoardCase case1 = this.board.getCase(vertCase, horiCase);
  BoardCase case2 = this.board.getCase(this.selectV, this.selectH);

  // Start selection
  if (this.selectV == -1 && this.selectH == -1) {
      if (case1.getState() == NEW) {
    this.selectV = vertCase;
    this.selectH = horiCase;
      }
  } // Switch selection
  else {
      if ((case1.getState() != OLD && case2.getState() != OLD)) {
    Debug.console(
      "switchLetterOnBoard", "switch",
      " from " + Debug.formatCoord(this.selectV, this.selectH)
      + " to " + Debug.formatCoord(vertCase, horiCase));

View Full Code Here

Examples of pdp.scrabble.game.BoardCase

    char c = '0';

    for (int i = 0; i < word.length(); i++)
    {
      //Get next board case depending on the direction.
      BoardCase nextBoardCase = this.gameEnv.board().getCase(
          (isVer) ? loc.getV() + i : loc.getV(),
              (isVer) ? loc.getH() : loc.getH() + i);


      wordMult *= Math.max(nextBoardCase.getWordMult(), 1);

      c = word.charAt(i);
      letterPoints = (c == Bag.JOKER)? 0 : this.gameEnv.bag().getLetterValue(c+"");
      if (!nextBoardCase.getMultUsed()) letterMult = Math.max(nextBoardCase.getLetterMult(), 1);
      wordPoints +=  letterPoints * letterMult;
      letterMult = 1;
    }

    return wordMult * wordPoints;
 
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.