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]
nodes[s] = Node(s,l,r)
pprint(nodes)
current = 'AAA'
steps = 0
index = 0
directions = d
while current != 'ZZZ':
steps += 1
directions = directions[index]
if directions == 'L':
count = 0
try:
while current != 'ZZZ':
steps += 1
current = nodes[current].left if d[count%len(d)] == 'L' else nodes[current].right
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'):