38 lines
829 B
Python
38 lines
829 B
Python
from intcode import IntCode
|
|
from tools.aoc import AOCDay
|
|
from typing import Any
|
|
|
|
|
|
class Day(AOCDay):
|
|
inputs = [
|
|
[
|
|
(4601506, "input05")
|
|
],
|
|
[
|
|
(5525561, "input05")
|
|
]
|
|
]
|
|
|
|
def part1(self) -> Any:
|
|
comp = IntCode(self.getInputAsArraySplit(",", int))
|
|
comp.addInput(1)
|
|
comp.start()
|
|
while True:
|
|
if (check := comp.getOutput()) != 0:
|
|
comp.join()
|
|
return check
|
|
|
|
def part2(self) -> Any:
|
|
comp = IntCode(self.getInputAsArraySplit(",", int))
|
|
comp.addInput(5)
|
|
comp.start()
|
|
while True:
|
|
if (check := comp.getOutput()) != 0:
|
|
comp.join()
|
|
return check
|
|
|
|
|
|
if __name__ == '__main__':
|
|
day = Day(2019, 5)
|
|
day.run(verbose=True)
|