Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
F**k it, going complex. solution in Creative category for Shooting Range by fuzzy-focus
def shot(*c):
c = [complex(*x)for x in c]
c = [x-c[2] for x in c]
a, b = [abs(c[3])*x/c[3] for x in c[:2]]
if a.imag * b.imag > 0: return -1
r = a.imag/(a-b).imag
x = (a+(b-a)*r).real > 0
r = abs(r) if x else -1
r = round(200*min(r,1-r))
return -1 if r<0 else r
Sept. 7, 2015
Comments: