Ejemplo n.º 1
0
  // What to do when a valid move has been made.
  protected void processValidMove(Move m) {
    edu.wpi.sudoku.model.SudokuBoard board = Model.getBoard();

    m.execute(board);
    Model.addMove(m);

    if (board.isComplete()) {
      // boardSolved();
      new UpdateController()
          .sendFinish(
              lobby, PlayerManager.get().getPlayerById(lobby.getContext().getUser()).getScore());
    }

    // Have we completed a Cell? If so, make the locked sound. Otherwise
    // go and make a small sound.
    Cell c = Cell.enclosingCell(m.getSquare());
    CellNormal cn = new CellNormal(c);
    boolean full = true; // assume we are done.
    for (edu.wpi.sudoku.model.Square s : cn) {
      if (board.isEmpty(s)) {
        full = false;
        break;
      }
    }

    if (full) {
      OneSoundPlayer.playSound(this.getClass().getResource("/sounds/operations/lockingSound.WAV"));
    } else {
      OneSoundPlayer.playSound(this.getClass().getResource("/sounds/operations/snapSound.WAV"));
    }
  }