Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Second solution in Clear category for Compass, Map and Spyglass by juestr
def navigation(seaside):
locations = { obj: (x, y)
for y, row in enumerate(seaside)
for x, obj in enumerate(row) if obj }
x0, y0 = locations['Y']
def distance(obj):
x, y = locations[obj]
return max(abs(x0 - x), abs(y0 - y))
return sum(distance(obj) for obj in 'CMS')
May 14, 2019