diff --git a/day16.py b/day16.py index 5e31301..842dab8 100644 --- a/day16.py +++ b/day16.py @@ -54,7 +54,7 @@ def get_tiles_from_all_paths(grid: Grid) -> int: visited = {} while queue: score, pos, facing, path = heappop(queue) - if pos in visited and score > visited[pos][0] + 1000: + if pos in visited and score > visited[pos] + 1000: continue if pos in path_scores and pos in visited: @@ -62,11 +62,7 @@ def get_tiles_from_all_paths(grid: Grid) -> int: target_path |= path continue - visited[pos] = (score, facing) - if pos == target: - target_path |= path - continue - + visited[pos] = score if score >= target_score: continue