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