generated from public/aoc_template
day16 - minor cleanups
This commit is contained in:
parent
b296e35b85
commit
060fd324b5
8
day16.py
8
day16.py
@ -54,7 +54,7 @@ def get_tiles_from_all_paths(grid: Grid) -> int:
|
|||||||
visited = {}
|
visited = {}
|
||||||
while queue:
|
while queue:
|
||||||
score, pos, facing, path = heappop(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
|
continue
|
||||||
|
|
||||||
if pos in path_scores and pos in visited:
|
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
|
target_path |= path
|
||||||
continue
|
continue
|
||||||
|
|
||||||
visited[pos] = (score, facing)
|
visited[pos] = score
|
||||||
if pos == target:
|
|
||||||
target_path |= path
|
|
||||||
continue
|
|
||||||
|
|
||||||
if score >= target_score:
|
if score >= target_score:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user