Skip to content

Instantly share code, notes, and snippets.

@LiaungYip
Created January 27, 2016 02:41
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 LiaungYip/c3fa879bf64475a14a9b to your computer and use it in GitHub Desktop.
Save LiaungYip/c3fa879bf64475a14a9b to your computer and use it in GitHub Desktop.
Ingress Portal Level Calculator
full_deploy = [
[0, 0, 0, 0, 0, 0, 0, 0], # Padding so agent levels are same as list indices
[1, 1, 1, 1, 1, 1, 1, 1],
[2, 2, 2, 2, 1, 1, 1, 1],
[3, 3, 3, 3, 2, 2, 2, 2],
[4, 4, 4, 4, 3, 3, 3, 3],
[5, 5, 4, 4, 4, 4, 3, 3],
[6, 6, 5, 5, 4, 4, 4, 4],
[7, 6, 6, 5, 5, 4, 4, 4],
[8, 7, 6, 6, 5, 5, 4, 4],
]
agents = [8,8,7]
deploy = [0, 0, 0, 0, 0, 0, 0, 0]
for agent_level in agents:
print "-- L%i agent begins --" % agent_level
limit = list ( full_deploy[agent_level] ) # Copy list
deploy.sort()
for n, resonator_level in enumerate(deploy):
if limit[0] > deploy[n]:
print "L%i agent replacing R%i with R%i" % (agent_level, deploy[n], limit[0])
deploy[n] = limit.pop(0)
deploy.sort(reverse=True)
print deploy
print float(sum(deploy)) / len(deploy)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment