[ create a new paste ] login | about

Link: http://codepad.org/KEqxSa4j    [ raw code | output | fork ]

Python, pasted on Oct 12:
# armor: damage subtraction, miss multiplier
# swords: damage, attacks per unit time

colors = 'blue red yellow green'.split()
armor = [(-12, .9), (-8, .85), (-20, 1.0), (0, .76)]
swords = [(100, 80), (80, 100), (150, 50), (50, 180)]

def cross(sword,armor):
  damage, attacks = sword
  subtraction, miss = armor
  return (damage+subtraction)*attacks*miss


# swords are columns, armor are rows
tbl = [[cross(s,a) for s in swords] for a in armor]

armor_max = [max(dmgs) for dmgs in tbl]
sword_min = [min([tbl[i][x] for i in range(4)]) for x in range(4)]

min_armor_max = armor_max.index(min(armor_max))
max_sword_min = sword_min.index(max(sword_min))

# styling be damned

print "Selected Armor: ", colors[min_armor_max], " with max damage ", armor_max[min_armor_max]
print "Selected Sword: ", colors[max_sword_min], " with min damage ", sword_min[max_sword_min]


Output:
1
2
Selected Armor:  blue  with max damage  6336.0
Selected Sword:  blue  with min damage  6080.0


Create a new paste based on this one


Comments: