Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Ore In The Desert by Somebody12345678910
import itertools
import random
candidates = None
def checkio(previous):
global candidates
times = len(previous)
if times == 0:
candidates = list(itertools.product(range(10), repeat=2))
candidates.remove((0, 0))
return [0, 0]
p = previous[-1]
remove = []
for d in candidates:
if round(((d[0] - p[0]) ** 2 + (d[1] - p[1]) ** 2) ** .5) != p[2]:
remove.append(d)
for r in remove:
candidates.remove(r)
c = random.choice(candidates)
return c
July 17, 2021