Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Sunflower solution in Creative category for Colder-Warmer by veky
def sgn(x): # signum function
try: return x//abs(x)
except ZeroDivisionError: return 0
def checkio(steps):
for index in range(100): # 61 is 100//goldenratio, prime to 10
oldQ, point1 = None, divmod(61 * index % 100, 10)
for *point2, direction in steps: # comparing quadrances
Q = sum((x1 - x2)**2 for x1, x2 in zip(point1, point2))
if not Q or oldQ and sgn(oldQ - Q) != direction: break
oldQ = Q
else: return point1
Dec. 24, 2013
Comments: