2019-04-23 17:15:05 +02:00
|
|
|
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)
|
2019-04-10 11:18:22 +02:00
|
|
|
return gc_moveset
|
|
|
|
x,y = gc_moveset[-1]
|
2019-04-23 17:15:05 +02:00
|
|
|
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)
|