Trying 2023-12-08 p2

This commit is contained in:
FrederikBaerentsen 2023-12-08 15:24:12 +01:00
parent a1df3dee02
commit ccc19511e0

View File

@ -39,16 +39,23 @@ for i in maps:
r = i[12:15] r = i[12:15]
nodes[s] = Node(s,l,r) nodes[s] = Node(s,l,r)
pprint(nodes)
current = 'AAA' current = 'AAA'
steps = 0 steps = 0
index = 0 count = 0
directions = d try:
while current != 'ZZZ': while current != 'ZZZ':
steps += 1 steps += 1
directions = directions[index] current = nodes[current].left if d[count%len(d)] == 'L' else nodes[current].right
if directions == 'L': count += 1
print(steps)
except:
print()
print(steps) current = {}
for i in nodes:
if i.endswith('A'):
current[i] = i
#while not current.endswith('Z'):