import matplotlib.image as mpimg import matplotlib.pyplot as plt import numpy as np import matplotlib.cm as cm from datetime import timedelta img = mpimg.imread("notch.png") counts = [0 for i in range(9)] materials = [ "Cobblestone", "Compressed Cobblestone", "Double Compressed Cobblestone", "Triple Compressed Cobblestone", "Quadruple Compressed Cobblestone", "Quintuple Compressed Cobblestone", "Sextuple Compressed Cobblestone", "Septuple Compressed Cobblestone", "Octuple Compressed Cobblestone" ] materials.reverse() materials = map(lambda x: x.rjust(32),materials) for r in range(len(img)): for c in range(len(img[0])): pixel = int(round(img[r][c]*8+1)) counts[pixel-1] += 1 img[r][c] = pixel f = open("notch.txt","w") for r in range(len(img)): for c in range(len(img[0])): f.write(str(int(img[r][c]))) f.write("\n") f.close() cobble = 0 print "Required materials:" for i,c in enumerate(counts): print " {}: {} ({} stacks + {})".format(materials[i],c,*divmod(c,64)) cobble += c*(9**(9-i)) print t = timedelta(seconds=(cobble/(20.0*64))) if t.days > 1: time = ["days", t.days] elif t.hours > 1: time = ["hours", t.hours] elif t.minutes > 1: time = ["minutes", t.minutes] else: time = ["seconds", t.seconds] print " Total number of Cobblestone required: %d (will take %.1f %s at 64 cobblestone/tick)." % (cobble, time[1], time[0]) img = (1/9.0)*img plt.imshow(img, cmap=cm.Greys_r) plt.show()