Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Uncategorized category for Open Labyrinth by TovarischZhukov
def find(maze_map, checked, end, curr, path):
if curr not in checked and maze_map[curr[0]][curr[1]] == 0:
checked.append(curr)
if curr == end:
return path
val = find(maze_map, checked, end, (curr[0], min(curr[1]+1, len(maze_map)-2)), path+"E")
if val: return val
val = find(maze_map, checked, end, (curr[0], max(curr[1]-1, 1)), path+"W")
if val: return val
val = find(maze_map, checked, end, (max(curr[0]-1, 1), curr[1]), path+"N")
if val: return val
val = find(maze_map, checked, end, (min(curr[0]+1, len(maze_map)-2), curr[1]), path+"S")
if val: return val
def checkio(maze_map):
checked = []
return find(maze_map, checked, (10,10), (1,1), "")
Dec. 19, 2015