From 86665d264a775c9762c52884c5cc126224032c92 Mon Sep 17 00:00:00 2001 From: Pascal Lais Date: Thu, 16 Dec 2021 16:53:25 +0100 Subject: [PATCH] Rename a variable --- day-15/day-15.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/day-15/day-15.py b/day-15/day-15.py index f74ee1b..cfe6bff 100644 --- a/day-15/day-15.py +++ b/day-15/day-15.py @@ -61,13 +61,13 @@ def part_2(input): if not (x, y) in done: next.add((x, y)) for (x, y) in next: - next_cost = nodes[(x % x_size, y % y_size)] + \ + next_node_cost = nodes[(x % x_size, y % y_size)] + \ (x // x_size) + (y // y_size) - if next_cost > 9: - next_cost -= 9 - if not (x, y) in cost or (cur_cost + next_cost) < cost[(x, y)]: - cost[(x, y)] = cur_cost + next_cost - heappush(queue, (cur_cost + next_cost, (x, y))) + if next_node_cost > 9: + next_node_cost -= 9 + if not (x, y) in cost or (cur_cost + next_node_cost) < cost[(x, y)]: + cost[(x, y)] = cur_cost + next_node_cost + heappush(queue, (cur_cost + next_node_cost, (x, y))) done.add(current) result = cost[end] print("Part 2 result:", result)