+/AoC

advent of code

git clone https://git.julia.blue/+/AoC

Joseph RyanDays 7-14 (in python for now)a7718a0

master
432 B14 linesraw
1from itertools import accumulate, starmap
2from operator import mul
3
4steps = [0, 1]
5for line in open("input"):
6    steps += [0] if line.startswith("n") else [0, int(line.split()[-1])]
7cycles = list(accumulate(steps))
8print(sum(starmap(mul, list(enumerate(cycles))[20::40])))
9for i in range(1, len(steps) - 1):
10    pos = (i - 1) % 40
11    if not pos:
12        print()
13    print("#" if abs(pos - cycles[i]) < 2 else ".", end="")
14print()