This commit is contained in:
Stefan Harmuth 2022-11-20 07:13:35 +01:00
parent 949bccf51f
commit 64c888dc50
2 changed files with 1113 additions and 0 deletions

39
day05.py Normal file
View File

@ -0,0 +1,39 @@
from tools.aoc import AOCDay
from typing import Any
class Day(AOCDay):
inputs = [
[
(364539, "input5")
],
[
(27477714, "input5")
]
]
def get_steps(self, p2: bool = False) -> int:
inst = self.getInputListAsType(int)
index = 0
count = 0
while 0 <= index < len(inst):
count += 1
if p2 and inst[index] >= 3:
inst[index] -= 1
index += inst[index] + 1
else:
inst[index] += 1
index += inst[index] - 1
return count
def part1(self) -> Any:
return self.get_steps()
def part2(self) -> Any:
return self.get_steps(True)
if __name__ == '__main__':
day = Day(2017, 5)
day.run(verbose=True)

1074
inputs/input5 Normal file

File diff suppressed because it is too large Load Diff