Skip to content

Instantly share code, notes, and snippets.

@Mitame
Created April 5, 2015 19:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mitame/8e6152f3121888b5c04e to your computer and use it in GitHub Desktop.
Save Mitame/8e6152f3121888b5c04e to your computer and use it in GitHub Desktop.
Estimates the average size of a Powder Toy save.
#!/usr/bin/env python3
import urllib.request
import random
sizes = []
try:
for x in range(0,500):
saveID = random.randint(0,1700000)
save = urllib.request.urlopen("http://static.powdertoy.co.uk/%s.cps" % str(saveID)).read()
print("%s: %s bytes"%(str(saveID),str(len(save))))
sizes.append(len(save))
except:
print("ERROR")
print("Average: %s" % str(sum(sizes)/len(sizes)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment