Finished 2023-12-08 p1
This commit is contained in:
parent
b6ae910775
commit
ffe9616398
@ -35,47 +35,48 @@ for i in maps:
|
||||
nmaps.append([s,l,r])
|
||||
|
||||
|
||||
pprint(d)
|
||||
pprint(maps)
|
||||
pprint(nmaps)
|
||||
#pprint(d)
|
||||
#pprint(maps)
|
||||
#pprint(nmaps)
|
||||
|
||||
count = 0
|
||||
way = nmaps[0][0]
|
||||
way = 'AAA'
|
||||
first = True
|
||||
found = False
|
||||
index = 0
|
||||
print('Starting with ' + way)
|
||||
#print('Starting with ' + way)
|
||||
cycle = 0
|
||||
while found == False:
|
||||
for i in d:
|
||||
print('Finding Index for ' + way,end=' at ')
|
||||
cycle += 1
|
||||
for idx, i in enumerate(d):
|
||||
#print(way)
|
||||
#print('Finding Index for ' + way,end=' at ')
|
||||
c = way
|
||||
#if first == False:
|
||||
index = [(i,table.index(c)) for i, table in enumerate(nmaps) if c in table]
|
||||
print(index,end='')
|
||||
#print(index,end='')
|
||||
for j in index:
|
||||
if list(j)[1] == 0:
|
||||
index = list(j)[0]
|
||||
#index = list(index[0])[1]
|
||||
print(' (true index ',end='')
|
||||
print(index,end=') ')
|
||||
#print(' (true index ',end='')
|
||||
#print(index,end=') ')
|
||||
#else:
|
||||
# first = False
|
||||
if i == 'R':
|
||||
way = nmaps[index][2]
|
||||
print('Going R to ' + way)
|
||||
#print('Going R to ' + way)
|
||||
if i == 'L':
|
||||
way = nmaps[index][1]
|
||||
print('Going L to ' + way)
|
||||
#print('Going L to ' + way)
|
||||
count += 1
|
||||
if way == 'ZZZ':
|
||||
found = True
|
||||
#print('COUND')
|
||||
continue
|
||||
#if nmaps[index][1] == 'ZZZ' or nmaps[index][2] == 'ZZZ':
|
||||
# print(nmaps[index][1],nmaps[index][2])
|
||||
# print('Found at ' + str(index) + ' with count ' + str(count))
|
||||
# found = True
|
||||
# continue
|
||||
# input()
|
||||
print(count)
|
||||
|
||||
|
||||
print('Result: ' + str(count))
|
||||
|
Loading…
Reference in New Issue
Block a user