advent-of-code/2018/day-12/hack.py

13 lines
346 B
Python
Raw Normal View History

2018-12-13 17:11:45 +01:00
state = '##.##.##.##....##.##.##.##.##.##.##.##.##....##.##.##.##.##.##.##.##.##....##.##.##....##.##.##.##.##.##....##.##.##.##.##.##.##.##....##.##.##.##.##.##.##.##.##.##'
gens = 50000000000
start_idx = gens - 64
res = 0
for i, pot_val in enumerate(state):
pot_id = i + start_idx
if pot_val == '#':
res += pot_id
print(res)