34 lines
759 B
Python
34 lines
759 B
Python
from asembunny import Computer, parse_assembunny_code
|
|
from tools.aoc import AOCDay
|
|
from typing import Any
|
|
|
|
|
|
class Day(AOCDay):
|
|
inputs = [
|
|
[
|
|
(198, "input25"),
|
|
],
|
|
[
|
|
(None, "input25"),
|
|
],
|
|
]
|
|
|
|
def part1(self) -> Any:
|
|
computer = Computer(parse_assembunny_code(self.getInput()))
|
|
computer.set_max_output_len(20)
|
|
ans = 0
|
|
while True:
|
|
computer.reset(reg_a=ans)
|
|
computer.run()
|
|
if computer.output == [0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1]:
|
|
return ans
|
|
ans += 1
|
|
|
|
def part2(self) -> Any:
|
|
return ""
|
|
|
|
|
|
if __name__ == "__main__":
|
|
day = Day(2016, 25)
|
|
day.run(verbose=True)
|