Trying 2023-12-08 p2
This commit is contained in:
parent
a1df3dee02
commit
ccc19511e0
@ -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
|
||||
count = 0
|
||||
try:
|
||||
while current != 'ZZZ':
|
||||
steps += 1
|
||||
directions = directions[index]
|
||||
if directions == 'L':
|
||||
|
||||
|
||||
current = nodes[current].left if d[count%len(d)] == 'L' else nodes[current].right
|
||||
count += 1
|
||||
print(steps)
|
||||
except:
|
||||
print()
|
||||
|
||||
|
||||
current = {}
|
||||
for i in nodes:
|
||||
if i.endswith('A'):
|
||||
current[i] = i
|
||||
|
||||
#while not current.endswith('Z'):
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user