Esempio n. 1
0
  private void auto() {
    Step step = null;
    try {
      step = board.auto();
    } catch (Exception e) {
      logger.error("Exception in auto?", e);
      AlertFactory.createError(e).showAndWait();
    }

    // didn't solve anything, don't remember this step
    if (step == null) {
      return;
    }

    steps.push(step);

    Set<Integer> groupIds = new HashSet<Integer>();
    for (CellSnapshot snapshot : step.snapshots) {
      Cell affectedCell = board.getCell(snapshot.row, snapshot.col);
      if (snapshot.isMain()) {
        groupIds.add(affectedCell.getGroupId());
      }
      boardView.updateCellView(affectedCell);
    }

    for (int groupId : groupIds) {
      updateGroupSumView(groupId);
    }

    // after auto, game might be solved
    checkGameIsSolved();
  }