aoc2019/day05.py

27 lines
671 B
Python

from aoc import AOCDay
from intcode import IntCode
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