SHARE
TWEET

pixelminer solution finder

davewagner2 Oct 24th, 2015 207 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/python
  2.  
  3. class equipment:
  4.         def __init__ (self, iname, icost, ispeed):
  5.                 self.cost = icost
  6.                 self.speed = ispeed
  7.                 self.name = iname
  8.  
  9. equipmentlist = []
  10. equipmentlist.append(equipment("Hands",0,1))
  11. equipmentlist.append(equipment("Pickaxe",10,2))
  12. equipmentlist.append(equipment("Shovel",180,3))
  13. equipmentlist.append(equipment("Jackhammer",720,4))
  14. equipmentlist.append(equipment("Rotivator",12000,6))
  15. equipmentlist.append(equipment("Wolf Claws",259200,9))
  16. equipmentlist.append(equipment("Drill Gun",907200,14))
  17. equipmentlist.append(equipment("Mower",3110440,20))
  18. equipmentlist.append(equipment("The Cleaner",7873200,30))
  19. equipmentlist.append(equipment("Scoop Digger",26244000,46))
  20. equipmentlist.append(equipment("Clawing Digger",43302600,68))
  21. equipmentlist.append(equipment("Harvester",70858800,103))
  22. equipmentlist.append(equipment("Goblin Team",115145550,154))
  23. equipmentlist.append(equipment("Drill Machine",186004350,231))
  24. equipmentlist.append(equipment("Mutant Mole",298935563,346))
  25. equipmentlist.append(equipment("Power Loader",478296900,519))
  26. equipmentlist.append(equipment("Excavator",762285684,778))
  27. equipmentlist.append(equipment("Ghost Ship",1210689028,1168 ))
  28. equipmentlist.append(equipment("Dragon",1916924295,1752 ))
  29. equipmentlist.append(equipment("Mothership",3026722570,2627 ))
  30.  
  31. multipliercosts = [
  32.         0,
  33.         5,
  34.         16,
  35.         49,
  36.         152,
  37.         474,
  38.         1478,
  39.         4612,
  40.         14390,
  41.         44896,
  42.         140075,
  43.         437035,
  44.         1363548,
  45.         4254271,
  46.         13273325,
  47.         41412774,
  48.         129207854,
  49.         403128506,
  50.         1127760938,
  51.         3924214125]
  52.  
  53. class node:
  54.         def __init__(self,leasttimetoroot,shortestparent,currentspeed,parentequip,parentmult):
  55.                 self.leasttimetoroot = leasttimetoroot
  56.                 self.shortestparent = shortestparent
  57.                 self.currentspeed =  currentspeed
  58.                 self.parentequip = parentequip
  59.                 self.parentmult = parentmult
  60.  
  61. network = {}
  62. network["0-0"] = node(0,"0-0",1,0,0)
  63. for e in range(0,20):
  64.         for m in range(0,20):
  65.                 if e:
  66.                         equipparent = repr(e - 1) + "-" + repr(m)
  67.                         equiptimetoroot = (equipmentlist[e].cost // network[equipparent].currentspeed) + network[equipparent].leasttimetoroot
  68.                         thisnodename = repr(e) + "-" + repr(m)
  69.                         if not network.has_key(thisnodename):
  70.                                 network[thisnodename] = node(equiptimetoroot,equipparent,equipmentlist[e].speed * (m + 1),e - 1,m)
  71.                         if equiptimetoroot < network[thisnodename].leasttimetoroot:
  72.                                 network[thisnodename] = node(equiptimetoroot,equipparent,equipmentlist[e].speed * (m + 1),e - 1,m)
  73.                 if m:
  74.                         multparent = repr(e) + "-" + repr(m - 1)
  75.                         multtimetoroot = (multipliercosts[m] // network[multparent].currentspeed) + network[multparent].leasttimetoroot
  76.                         thisnodename = repr(e) + "-" + repr(m)
  77.                         if not network.has_key(thisnodename):
  78.                                 network[thisnodename] = node(multtimetoroot,multparent,equipmentlist[e].speed * (m + 1),e,m - 1)
  79.                         if multtimetoroot < network[thisnodename].leasttimetoroot:
  80.                                 network[thisnodename] = node(multtimetoroot,multparent,equipmentlist[e].speed * (m + 1),e,m - 1)
  81.  
  82. e = 19
  83. m = 19
  84. route = repr(network["19-19"].leasttimetoroot)
  85. while (e or m):
  86.         thisnode = repr(e) + "-" + repr(m)
  87.         if e > network[thisnode].parentequip:
  88.                 route = equipmentlist[e].name + "," + route
  89.                 print equipmentlist[e].name,"-", network[thisnode].leasttimetoroot,"sec"
  90.         if m > network[thisnode].parentmult:
  91.                 route = "Mult " + repr(m+1) + "x," + route
  92.                 print repr(m + 1) +"x Multiplier","-", network[thisnode].leasttimetoroot,"sec"
  93.         e = network[thisnode].parentequip
  94.         m = network[thisnode].parentmult
  95.  
  96. print route
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top