14 lines
615 B
Python
14 lines
615 B
Python
from utilities import movement,check_moves
|
|
def DFS(grid, avaliable_movement, gc_moveset,goal):
|
|
print(gc_moveset)
|
|
if(gc_moveset[-1] in goal or len(avaliable_movement) == 0):
|
|
print("Do zwrocenia: ",gc_moveset)
|
|
return gc_moveset
|
|
x,y = gc_moveset[-1]
|
|
for direction in avaliable_movement:
|
|
x_next, y_next = movement(grid,x,y)[0][direction]
|
|
avaliable_movement_next = check_moves(grid, x_next,y_next,direction)
|
|
gc_moveset_next = gc_moveset.copy()
|
|
gc_moveset_next.append([x_next,y_next])
|
|
return DFS(grid, avaliable_movement_next, gc_moveset_next,goal)
|