Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- #colony mines [met, cris, deut, fusionreactor, max_temp, name]
- colonies = [
- #[25, 23, 20, 11, 3, 'The Rice Fields'],
- # [0, 0, 0, 0, 74, 'New rice fields'],
- [28, 26, 22, 11, 78, 'Realm iii'],
- [26, 24, 20, 10, 59, 'Realm 900'],
- [26, 23, 20, 11, 73, 'Realm 305'],
- [26, 23, 20, 11, 48, 'Realm 3009'],
- [26, 23, 20, 11, 74, 'Realm 42'],
- [26, 23, 20, 11, 35, 'Realm 6'],
- [26, 23, 20, 10, 31, 'Realm 69']
- ]
- #Level of plasma-research
- plasma = 7
- #uni-speed
- unispeed = 5
- #base income of [met, cris, deut]
- base = [30, 15, 0]
- #buffer for total production
- production = [0, 0, 0]
- #mse to determine value
- mse = [2, 1, 1]
- #mse = [3, 2, 1]
- def upgradecosts(colo):
- return [[int(40*1.5**(colo[0]+1)), int(10*1.5**(colo[0]+1)), 0],
- [int(30*1.6**(colo[1]+1)), int(15*1.6**(colo[1]+1)), 0],
- [int(150*1.5**(colo[2]+1)), int(50*1.5**(colo[2]+1)), 0]]
- def upgradevalue(colo):
- return [[int(30*(colo[0]+1)*1.1**(colo[0]+1)*unispeed*(1+(plasma*0.01))) - int(30*colo[0]*1.1**colo[0]*unispeed*(1+(plasma*0.01))), 0, 0],
- [0, int(20*(colo[1]+1)*1.1**(colo[1]+1)*unispeed*(1+(plasma*0.01*2/3)))-int(20*colo[1]*1.1**colo[1]*unispeed*(1+(plasma*0.01*2/3))), 0],
- [0, 0, int(10*(colo[2]+1)*1.1**(colo[2]+1)*(1.44 - 0.004*colo[4])*unispeed*(1+(plasma*0.01*1/3)))-int(10*colo[2]*1.1**colo[2]*(1.44 - 0.004*colo[4])*unispeed*(1+(plasma*0.01*1/3)))]]
- def getproduction(colos):
- p = [0, 0, 0]
- for colo in colos:
- p[0] += int(30*colo[0]*1.1**colo[0]*unispeed*(1+(plasma*0.01)))
- p[1] += int(20*colo[1]*1.1**colo[1]*unispeed*(1+(plasma*0.01*2/3)))
- p[2] += int(10*colo[2]*1.1**colo[2]*(1.44 - 0.004*colo[4])*unispeed*(1+(plasma*0.01*1/3)))
- p[2] -= int(10*colo[3]*1.1**colo[3]*unispeed)
- p[0] += base[0]*unispeed
- p[1] += base[1]*unispeed
- p[2] += base[2]*unispeed
- return p
- def bestnext(colos, turns=10):
- colos = [colo[:] for colo in colos]
- nextturns = []
- for k in range(turns):
- best = None
- bestcosts = None
- for i in range(len(colos)):
- colo = colos[i]
- msecosts = [0, 0, 0]
- msevalues = [0, 0, 0]
- values = upgradevalue(colo)
- costs = upgradecosts(colo)
- for i in range(3):
- msecosts[i] = sum([int(costs[i][0]/mse[0]), int(costs[i][1]/mse[1]), int(costs[i][2]/mse[2])])
- msevalues[i] = sum([int(values[i][0]/mse[0]), int(values[i][1]/mse[1]), int(values[i][2]/mse[2])])
- if msecosts[0]/msevalues[0] < msecosts[1]/msevalues[1]:
- if msecosts[0]/msevalues[0] < msecosts[2]/msevalues[2]:
- bestchoice = [0 ,msecosts[0]/msevalues[0]]
- else:
- bestchoice = [2 ,msecosts[2]/msevalues[2]]
- elif msecosts[1]/msevalues[1] < msecosts[2]/msevalues[2]:
- bestchoice = [1 ,msecosts[1]/msevalues[1]]
- else:
- bestchoice = [2 ,msecosts[2]/msevalues[2]]
- if not best or best[1] > bestchoice[1]:
- best = bestchoice
- bestcosts = costs
- best.append(colo)
- mine = 'Met' if best[0] == 0 else 'Cris' if best[0] == 1 else 'Deut'
- production = getproduction(colos)
- time = max([bestcosts[best[0]][i] / production[i] for i in range(3)])
- print('{:<3}: Upgrade {:4} on {:15} from {} to {} ({}h {:2}min global production)'.format(k+1, mine, best[2][5], best[2][best[0]], best[2][best[0]]+1, int(time), int((time*60)%60)))
- print(*(costs[best[0]][i] for i in range(3)))
- best[2][best[0]] += 1
- if len(sys.argv) > 1:
- turns = int(sys.argv[1])
- else:
- turns = 20
- bestnext(colonies, turns)
- production = getproduction(colonies)
- print("\n\nTotal Production:\n{}k Met/h\n{}k Cris/h\n{}k Deut/h".format(production[0]//1000, production[1]//1000, production[2]//1000))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement