17-2-anim

This commit is contained in:
2024-12-18 19:48:26 +01:00
parent 0af1538d7f
commit 904f7f7c27
8 changed files with 3740 additions and 4 deletions

View File

@@ -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