You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
647 B
Python

6 years ago
state = [3, 7]
puzzle_in = 77201
elf_1 = 0
elf_2 = 1
def print_state():
out = ''
for i, el in enumerate(state):
if i == elf_1:
out += '(' + str(el) + ')'
elif i == elf_2:
out += '[' + str(el) + ']'
else:
out += ' ' + str(el) + ' '
print(out)
while len(state) < puzzle_in + 10:
val_1 = state[elf_1]
val_2 = state[elf_2]
state.extend([ int(x) for x in list(str(val_1 + val_2)) ])
elf_1 = (1 + elf_1 + val_1) % len(state)
elf_2 = (1 + elf_2 + val_2) % len(state)
# print_state()
print(''.join([str(x) for x in state[puzzle_in:puzzle_in + 10]]))