Skip to content

Instantly share code, notes, and snippets.

@murisimov
Last active February 4, 2016 17:11
Show Gist options
  • Save murisimov/6a56b57d523e5619a596 to your computer and use it in GitHub Desktop.
Save murisimov/6a56b57d523e5619a596 to your computer and use it in GitHub Desktop.
# Snippet to calculate farm amount.
# Here is how it works;
# 'shedule' is an array with dicts corresponding to each anomaly done. Key:values here are player:characters pairs.
# Example:
# shedule = [
# {
# 'agaf': 3,
# 'aiteri': 2,
# 'hel': 2
# },
# {
# 'agaf': 2,
# 'aiteri': 2,
# 'hel': 3,
# 'oleg': 4
# }
# ]
#
# 'quanity' is how many anomalies are;
#
# 'amount' is the total amount of ISK you've earned.
#
# That's it!
shedule = []
def calculate(quanity, total, shedule):
team = {}
for dct in shedule:
for name, v in dct.iteritems():
if name not in team: team[name] = {'total': 0, 'RAM': 0 }
amount = total / quanity
mods = [100, 87, 57, 28]
for n, anomaly in zip(range(len(shedule)), shedule):
total_pool = 0
for name, chars in anomaly.iteritems():
reward_relation = 0
for mod, i in zip(mods, range(chars)):
reward_relation += mods[i]
else:
total_pool += reward_relation
team[name]['RAM'] = reward_relation
else:
print "For the {0} anomaly each one gets:".format(n+1)
for name, chars in anomaly.iteritems():
reward = amount * (1 / float(total_pool/float(team[name]['RAM'])))
print "{0}: {1}kk ISK".format(name, round(reward, 2))
team[name]['total'] += reward
print
else:
print "Total rewards are:"
for name, values in team.iteritems():
print "{0}: {1}".format(name, round(values['total'], 2))
calculate(4, 2800, shedule)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment