31 lines
695 B
Python
31 lines
695 B
Python
from tools.aoc import AOCDay
|
|
from typing import Any
|
|
from asembunny import parse_assembunny_code, Computer
|
|
|
|
|
|
class Day(AOCDay):
|
|
inputs = [
|
|
[
|
|
(42, "input12_test"),
|
|
(318083, "input12"),
|
|
],
|
|
[
|
|
(9227737, "input12"),
|
|
],
|
|
]
|
|
|
|
def part1(self) -> Any:
|
|
computer = Computer(code=parse_assembunny_code(self.getInput()))
|
|
computer.run()
|
|
return computer.reg["a"]
|
|
|
|
def part2(self) -> Any:
|
|
computer = Computer(code=parse_assembunny_code(self.getInput()), reg_a=1)
|
|
computer.run()
|
|
return computer.reg["a"]
|
|
|
|
|
|
if __name__ == "__main__":
|
|
day = Day(2016, 12)
|
|
day.run(verbose=True)
|