17-2-anim
This commit is contained in:
@@ -58,7 +58,7 @@ def shortest_path(array, start, end):
|
||||
for dx, dy in [(0, 1), (1, 0), (0, -1), (-1, 0)]:
|
||||
nx, ny = x + dx, y + dy
|
||||
if 0 <= nx < zeilen and 0 <= ny < spalten and array[nx][ny] == '.' and (nx, ny) not in visited:
|
||||
queue.append(((nx, ny), pfad + [(nx, ny)]))
|
||||
queue.append(((nx, ny), pfad + [(ny, nx)]))
|
||||
visited.add((nx, ny))
|
||||
|
||||
return -1, [] # Kein Pfad gefunden
|
||||
|
||||
Reference in New Issue
Block a user