From dee3d1832176a0caa60770e87ff668811c1ebd8e Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Mon, 13 Dec 2021 10:12:10 +0000 Subject: day 13 --- 12.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '12.py') diff --git a/12.py b/12.py index f471e07..c46fbe6 100644 --- a/12.py +++ b/12.py @@ -10,7 +10,7 @@ with open_day(12) as f: adj[a].add(b) adj[b].add(a) -def count_paths(look_twice=False): +def count_paths(adj, look_twice=False): @cache def f(node, seen, saw_once=None): def descend(node, seen, saw_once): @@ -27,5 +27,5 @@ def count_paths(look_twice=False): return total + descend(node, seen, saw_once) return sum(f(n, frozenset(('start',))) for n in adj['start']) -print(count_paths()) -print(count_paths(True)) +print(count_paths(adj)) +print(count_paths(adj, True)) -- cgit v1.2.3-54-g00ecf