aoc2019/day05.py
2021-12-07 08:48:36 +01:00

27 lines
677 B
Python

from intcode import IntCode
from tools.aoc import AOCDay
from typing import Any
class Day(AOCDay):
test_solutions_p1 = []
test_solutions_p2 = []
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