# 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]