35 lines
662 B
Python
35 lines
662 B
Python
from tools.aoc import AOCDay
|
|
|
|
|
|
class Day(AOCDay):
|
|
inputs = [
|
|
[
|
|
(7, "test_input01"),
|
|
(1602, "input01")
|
|
],
|
|
[
|
|
(5, "test_input01"),
|
|
(1633, "input01")
|
|
]
|
|
]
|
|
|
|
def count(self, step: int = 1) -> int:
|
|
count = 0
|
|
depths = self.getInputListAsType(int)
|
|
for x in range(step, len(depths)):
|
|
if depths[x] > depths[x - step]:
|
|
count += 1
|
|
|
|
return count
|
|
|
|
def part1(self):
|
|
return self.count()
|
|
|
|
def part2(self):
|
|
return self.count(3)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
day = Day(2021, 1)
|
|
day.run(verbose=True)
|