/** * Marks tile at specified indeces. * * @param row row number * @param column column number */ public void markTile(int row, int column) { Tile tile = tiles[row][column]; if (tile.getState() == State.CLOSED) { tile.setState(State.MARKED); } else if (tile.getState() == State.MARKED) { tile.setState(State.CLOSED); } }
/** * Opens tile at specified indeces. * * @param row row number * @param column column number */ public void openTile(int row, int column) { Tile tile = tiles[row][column]; floodFill(row, column); if (tile.getState() == Tile.State.CLOSED) { tile.setState(Tile.State.OPEN); if (tile instanceof Mine) { state = GameState.FAILED; return; } if (isSolved()) { state = GameState.SOLVED; return; } } }