예제 #1
0
파일: stats.py 프로젝트: Linzee/py-2049
def stats(path, options):
    output = loadItems(path, options)

    itemsCount = len(output.items)
    if itemsCount > 0:
        print("Found " + str(itemsCount) + " entries")
        print("")
        #display statistics
        printStats(output)

        #display graph
        import plotStyle
        
        i = 0
        for someItems in output.stats.values():
            clr = plotStyle.tableau20[i % len(plotStyle.tableau20)]
            plt.plot(someItems, '-', color=clr)
            i += 1
        
        plotStyle.subplotStyle(plt.subplot(111))
        plotStyle.style(plt)
        
        if options.show:
            plt.show()
        else:
            plt.savefig("out.png", bbox_inches="tight")  
    else:
        print("No entries were found")
예제 #2
0
파일: 2048.py 프로젝트: Linzee/py-2048
        
        xses = numpy.arange(len(movesPerStrategy))
        
        plotStyle.subplotStyle(plt.subplot(131))
        plt.title('Moves')
        plt.bar(xses, movesPerStrategy, color=plotStyle.tableau20, tick_label=namesPerStrategy, align="center")

        plotStyle.subplotStyle(plt.subplot(132))
        plt.title('Score')
        plt.bar(xses, scorePerStrategy, color=plotStyle.tableau20, tick_label=namesPerStrategy, align="center")

        plotStyle.subplotStyle(plt.subplot(133))
        plt.title('Largest tile')
        plt.bar(xses, largestTilePerStragegy, color=plotStyle.tableau20, tick_label=namesPerStrategy, align="center")

        plotStyle.style(plt)

        try:
            mng = plt.get_current_fig_manager()
            mng.window.state('zoomed')
        except:
            print "Unexpected error.."

        plt.show()

    if predictableStrategyLevelsStats:
        fig = plt.figure(2)

        predictableStrategyLevelsAvgStats = []
        predictableStrategyLevelsAvgStats.append(0)
        for level in xrange(1, 5):