Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
8-liner: flying jar solution in Creative category for Escape by przemyslaw.daniel
def escape(jar, fly):
(W, H, D), (x0, y0, vx, vy) = jar, fly
w, h, d = W*(vy+(vy == 0)), H*(vx+(vx == 0)), D*vy
x, y, b, s, c = x0*vy-1, y0*vx-1, 0, 0, [w-d, w+d]
while (b := (b+((x+(s:=s+1)) % w == 0 or (y+s) % h == 0))) <= 20:
if min(c) < 2*((x+s) % w) < max(c) and (y+s) % (2*h) == h:
return True
return False
Dec. 4, 2019