This commit is contained in:
Tyrel Souza 2022-12-12 12:10:52 -05:00
parent 2918a33ca3
commit b87c69bd17

View File

@ -56,11 +56,10 @@ def part2(mx):
path = find_path(graph, start, end) path = find_path(graph, start, end)
paths.append(path) paths.append(path)
except algorithm.NoPathError: except algorithm.NoPathError:
#print('x', end='')
# This 'a' is in a puddle of 'c's, so it's not pathable # This 'a' is in a puddle of 'c's, so it's not pathable
pass pass
shortest = min(paths, key= lambda x: x.total_cost) shortest = min(paths, key= lambda x: x.total_cost)
matrix.apply_to_all(mx, lambda x: chr(x+ord('a'))) matrix.apply_to_all(mx, lambda x: chr(x+ord('a'))) # Back to letters, single char prettier
matrix.highlight(mx, red=shortest.nodes) matrix.highlight(mx, red=shortest.nodes)
print(shortest.total_cost) print(shortest.total_cost)