adventofcode-2020/15/part1

30 lines
428 B
Plaintext
Raw Normal View History

2020-12-26 21:51:16 +01:00
#!/usr/bin/python3
import sys
import time
from pprint import pprint
turn = 0
num = None
last_turn = {}
for a in sys.argv[1:]:
last_turn[num] = turn
turn += 1
num = int(a)
pprint(last_turn)
while True:
if num in last_turn:
new_num = turn - last_turn[num]
else:
new_num = 0
last_turn[num] = turn
num = new_num
turn += 1
print(turn, num)
if turn >= 2020:
break