1
0

aoc 2017 (day 1-6)

This commit is contained in:
2020-01-13 12:57:50 +01:00
parent 3968a11fa6
commit 4da4c47915
28 changed files with 2164 additions and 50 deletions

View File

@@ -0,0 +1,20 @@
#!/usr/bin/env python3
import aoc
import itertools
rawinput = aoc.read_input(5)
instructions = list(map(lambda x: int(x), rawinput.splitlines()))
ilen = len(instructions)
pos = 0
for i in itertools.count(1):
v = instructions[pos]
instructions[pos] += -1 if v >= 3 else 1
pos += v
if pos < 0 or pos >= ilen:
print(i)
exit()