Such a list to add x and y not duplicate data, such as (1,1,1) is not to add
Write the if the time can only compare the xy?
The import numpy as np
The import matplotlib. Pyplot as PLT
Maze=np. Loadtxt (' maze. TXT)
PLT. Imshow (maze, cmap='binary')
Stack=[]
Seen=[]
Def DFS (maze, y, x) :
Stack=[]
Seen=[]
Stack. Append ((y, x))
While (len (stack) & gt; 0) :
Print ("="poen list, stack)
Print (="close" list are seen)
(y, x)=stack. Pop ()
Print (" pop ", (y, x), "\ n")
Seen. Append ((y, x))
For (next_y, next_x) in [(y + 1, x), (y, x + 1), (y, x - 1), (y, x)] :
If maze [next_y] [next_x]==0 and (next_y next_x) not seen in:
Stack. Append ((next_y next_x))
If (y, x)==(13, 13) :
Break
DFS (maze, 1, 1)
Such a maze looking for program will change according to the path cost now find
For path assignment if any good solution?
The great god save the children
CodePudding user response:
Didn't understand what you mean