private void endGame(int i) {
        isInGamePlay = false;

        for (Cell[] cellArray : cells) {
            for (Cell cell : cellArray) {
                cell.reveal();
            }
        }

        if (listener != null) {
            if (i == -1)
                listener.gameFinished(false);
            else if (i == 1)
                listener.gameFinished(true);
        }
    }