Package pdp.scrabble.game

Examples of pdp.scrabble.game.Letter


    // Render player letters

    // For each rack letter
    for (int i = 0; i < MAX_RACK_LETTERS; i++) {
      Letter letter = rack.getLetter(ordre[i]);
      int x = 16 + ox + i * 64;
      int y = 16 + oy;

      // Draw empty case
      g.setColor(Color.BLACK);
      g.drawRect(x, y, CASE_SIZE, CASE_SIZE);

      // Draw occupied case
      if (letter != null) {
        letter.render(g, x, y);

        // Color selected letter
        if (i == selected) {
          g.setColor(SELECTED_CASE_COLOR);
          g.fillRect(x, y, CASE_SIZE, CASE_SIZE);
        }
        // Color hovered Letter
        if (i == hovered) {
          g.setColor(SELECTED_RACK_LETTER_COLOR);
          g.fillRect(x, y, CASE_SIZE, CASE_SIZE);
        }
      }

    }


    // Color letter that are marked to be reset
    for (Integer index : toReset) {
      Letter letterToReset = rack.getLetter(ordre[index]);

      if (letterToReset != null) {
        int x = 16 + ox + index * 64;
        int y = 16 + oy;
        g.setColor(SELECTED_RACK_LETTER_RESET_COLOR);
View Full Code Here


  boardCase.setChecked(this.checked);
  boardCase.setIndex(this.getIndex());
  boardCase.setMultUsed(this.multUsed);
  boardCase.setState(this.getState());

  Letter l = this.getLetter();
  if (l != null) {
      boardCase.setLetter(l.clone());
  }

  return boardCase;
    }
View Full Code Here

  for (int i = 0; i < this.numberOfDifferentLetter; i++) {
      this.uses[i] = 0;
  }

  // Calculate new value considering known used letters
  Letter letter = null;
  for (int v = 0; v < Board.VERT_DIM; v++) {
      for (int h = 0; h < Board.HORI_DIM; h++) {
    letter = board.getCase(v, h).getLetter();
    if (letter != null) {
        this.uses[Tool.getNumericValue(letter.getName())]++;
    }
      }
  }
  for (int i = 0; i < Rack.MAX_RACK_LETTERS; i++) {
      letter = player.getRack().getLetter(i);
      if (letter != null) {
    this.uses[Tool.getNumericValue(letter.getName())]++;
      }
  }

  // Calculate final percent
  for (int i = 0; i < this.numberOfDifferentLetter; i++) {
View Full Code Here

    public void play(Board board, Player p) {
  Location currentLoc = this.first.clone();
  for (int i=0 ; i<this.word.length() ; i++) {
      char c = this.word.charAt(i);
      if (board.isFree(currentLoc.getH(), currentLoc.getV())) {
    Letter currentLetter = null;
    if (Character.isLowerCase(c)) {
        currentLetter = p.getRack().getLetter(Bag.JOKER);
        p.getRack().removeLetter(currentLetter);
        currentLetter.setJokerChar(Character.toUpperCase(c));
    }
    else {
        currentLetter = p.getRack().getLetter(c);
        p.getRack().removeLetter(currentLetter);
    }
View Full Code Here

TOP

Related Classes of pdp.scrabble.game.Letter

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.