44 lines
767 B
Python
44 lines
767 B
Python
from aoc.input import get_input
|
|
from aoc.partselector import part_one, part_two
|
|
|
|
def pw(line):
|
|
return line
|
|
|
|
inp = get_input(pw)
|
|
|
|
if part_one():
|
|
x = 0
|
|
count = 0
|
|
for i in inp:
|
|
if i[x%len(i)] == "#":
|
|
count +=1
|
|
x +=3
|
|
print(i)
|
|
print (count)
|
|
|
|
|
|
if part_two():
|
|
x = 0
|
|
total = 1
|
|
for slope in (1, 3, 5, 7):
|
|
x = 0
|
|
count = 0
|
|
for i in inp:
|
|
if i[x%len(i)] == "#":
|
|
count +=1
|
|
x +=slope
|
|
total *= count
|
|
print(count)
|
|
count = 0
|
|
x = 0
|
|
for z, i in enumerate(inp):
|
|
if z % 2 == 1:
|
|
continue
|
|
if i[x%len(i)] == "#":
|
|
count +=1
|
|
x +=1
|
|
print(count)
|
|
total *= count
|
|
print (total)
|
|
|