def gatherStats(self):
        self.statString = 'Unable to fetch solution logs.'
        stats = None
        try:
            with open('solutionLogs.txt') as file:
                stats = eval(file.read())
        except: return
        if stats is not None:
            self.statString = ''

            stats = [s.split(';') for s in stats]

            moves = [stat[-1] for stat in stats] # Gets last element
            moves = [mv[6:] for mv in moves] # Remove "Moves:"
            moves = [int(mv) for mv in moves]
            if len(moves) == 0:
                self.statString += "No solutions generated yet."
                return
            self.statString += "%d solution%s logged.\n" % (len(moves), '' if len(moves)==1 else 's')
            avgMoves = sum(moves)/len(moves)
            self.statString += "Average number of 90 degree face rotations per solution: %d\n" % (avgMoves)

            times = [stat[-2] for stat in stats] # gets 2nd to last element
            times = [tm[6:-4] for tm in times] # removes "Time: " ... " sec"
            times = [float(tm) for tm in times]
            avgTime = sum(times)/(max(1, len(times)))
            self.statString += "Average time needed to generate a solution: %0.4f seconds" % (avgTime)
dataset/ETHPy150Open bluquar/cubr/cube.py/Cube.gatherStats/original