Skip to content

Commit f299022

Browse files
committed
cosmetics
1 parent 2e2e167 commit f299022

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

2023/day08/run.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,12 @@ def load_data(filename):
1616
instructions, maps = load_data('input.txt')
1717

1818
def walk(node, end):
19+
def next_node(node, instruction):
20+
return maps[node][{"L": 0, "R": 1}[instruction]]
1921
steps = 0
2022
while not end(node):
2123
for i in instructions:
22-
node = maps[node][{"L": 0, "R": 1}[i]]
24+
node = next_node(node, i)
2325
steps += 1
2426
return steps
2527

0 commit comments

Comments
 (0)