mirror of
https://github.com/peter-tanner/advent-of-code-2020.git
synced 2024-11-30 19:00:17 +08:00
19 lines
333 B
Python
19 lines
333 B
Python
|
|
||
|
lines = open('input').read().splitlines()
|
||
|
period = 31 #in chars
|
||
|
|
||
|
mat = []
|
||
|
for line in lines:
|
||
|
mat_row = [1 if x == '#' else 0 for x in list(line)]
|
||
|
mat.append(mat_row)
|
||
|
|
||
|
count = 0
|
||
|
j_ = 0
|
||
|
for i in range(0, len(mat)):
|
||
|
print(mat[i])
|
||
|
j = j_ % period
|
||
|
j_ += 3
|
||
|
|
||
|
if (mat[i][j] == 1):
|
||
|
count += 1
|
||
|
print(count)
|