Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Speedy category for Open Labyrinth by JamesNippoc
def checkio(maze_map):
M = maze_map
E = [["S",2,1],["E",1,2]]
D = ["N","E","S","W"]
C = [[-1,0],[0,1],[1,0],[0,-1]]
while E:
for l in E:
s,x,y = l[0],l[1],l[2]
E.remove(l)
if (x,y) == (10,10): return s
if not M[x][y]:
k = (D.index(s[-1])+2)%4
for i in range(4):
if i != k: E.append([s+D[i],x+C[i][0],y+C[i][1]])
return "rien trouvé"
May 22, 2014
Comments: