def complement_bonus(winners, candidate): L1, a1, b1 = candidate R, G, B = lab_to_rgb(candidate) avg = (R+G+B)/3 weight = 1.0 for L2, a2, b2 in winners: dotprod = (a1*a2 + b1*b2)/10000 if dotprod < 0: dotprod *= -2 weight *= dotprod weight /= (0.5 + abs(avg - G)) return weight
def output_colors(labcolors): return [lab_to_rgb(c) for c in sorted(labcolors)]