From 060fd324b50b2a426fdf1a92dd68dd565334d98e Mon Sep 17 00:00:00 2001 From: Stefan Harmuth Date: Mon, 16 Dec 2024 13:37:23 +0100 Subject: [PATCH] day16 - minor cleanups --- day16.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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