Added 2017/16

This commit is contained in:
2024-11-26 19:42:34 +01:00
parent 6aaae91ea6
commit 72a2175d09
6 changed files with 316 additions and 11 deletions
+8 -4
View File
@@ -33,8 +33,6 @@ dance?
Your puzzle answer was `ehdpincaogkblmfj`.
The first half of this puzzle is complete! It provides one gold star: \*
## \-\-- Part Two \-\-- {#part2}
Now that you\'re starting to get a feel for the dance moves, you turn
@@ -53,7 +51,13 @@ In the example above, their second dance would *begin* with the order
*In what order are the programs standing* after their billion dances?
Answer:
Your puzzle answer was `bpcekomfgjdlinha`.
Although it hasn\'t changed, you can still [get your puzzle
Both parts of this puzzle are complete! They provide two gold stars:
\*\*
At this point, you should [return to your Advent calendar](/2017) and
try another puzzle.
If you still want to see it, you can [get your puzzle
input](16/input).
+18 -7
View File
@@ -2,6 +2,7 @@
import sys,re,collections
from pprint import pprint
sys.path.insert(0, '../../')
from fred import list2int
@@ -91,6 +92,7 @@ if part == 1:
#########################################
if part == 2:
start_value = list('abcdefghijklmnop')
with open(input_f) as file:
for line in file:
@@ -100,9 +102,14 @@ if part == 2:
#print(programs)
#print(instructions)
print(len(instructions))
#print(len(instructions))
for r in range(0,1000000000):
duplicates = []
done = False
indx = 0
while not done:
#print(r,list(programs))
#input()
for idx,i in enumerate(instructions):
inst = parse_input(i)
#print(idx,end=' ')
@@ -122,11 +129,15 @@ if part == 2:
else:
print(inst)
input()
if r % 10000 == 0:
print(r)
if start_value == list(programs):
#print(start_value)
#print(list(programs))
done = True
duplicates.append(list(programs))
indx += 1
for i in programs:
print(i,end='')
print()
print(''.join(duplicates[(1000000000%indx)-1]))