Esempio n. 1
0
  private void updateCellValue(int row, int col, int value) {
    Cell cell = board.getCell(row, col);

    // not allows to update cell value when cell is locked, or the new value is not changed
    if (cell.isLocked() || cell.getValue() == value) {
      return;
    }

    Step step = board.updateCellValue(row, col, value, autoMode.isSelected());
    boardView.updateCellView(cell);

    for (CellSnapshot snapshot : step.snapshots) {
      Cell affectedCell = board.getCell(snapshot.row, snapshot.col);
      boardView.updateCellView(affectedCell);
    }

    steps.push(step);

    // current sum of group is changed
    updateGroupSumView(cell.getGroupId());

    // check if game is solved
    checkGameIsSolved();
  }