2015 day 9

This commit is contained in:
2026-06-02 13:25:23 +02:00
parent f2f22b08a0
commit 673f9a0205
2 changed files with 40 additions and 1 deletions
+4 -1
View File
@@ -28,7 +28,10 @@ def can_reach(pos, obstacles, grid_size):
return False
def search(obstacles, start, goal, grid_size): # could just use bfs?
def search(obstacles, start, goal, grid_size):
"""
Dijkstra's algorithm. Could as well use BFS since step costs are uniform. (n = Node(new_pos, node.cost + 1))
"""
queue = [Node(start)]
visited = set()
i = 0