+/AoC

advent of code

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

Joseph RyanDay 6f7643a9

master
640 B24 linesraw
1start = list(map(int, open("input").read().split(",")))
2current = [1] * 8 + [0] * 293
3new = [1] + [0] * 299
4def size(n):
5    if not current[n]:
6        current[n] = size(n-1) + new[n-9] + new[n-7]
7        new[n] = new[n-9] + new[n-7]
8    return current[n]
9
10def solve(l, n):
11    return sum((size(n + 2 + 6-x) for x in l))
12
13print(solve(start, 80))
14print(solve(start, 256))
15
16tick = lambda l: [n-1 if n > 0 else 6 for n in l] + [8] * l.count(0)
17# a = start[:]
18# for i in range(80):
19    # a = tick(a)
20    # print("[", ' '.join(map(str,a)), "]")
21    # print(i, len(a), size(i+1))
22    # size(i+3)
23    # print(a.count(8), new[i+3])
24# print(len(a))