From 05e2a4f3a77c6e140890588d5e7fa3a06d19c49d Mon Sep 17 00:00:00 2001 From: Bert Peters Date: Sat, 3 Jul 2021 17:59:43 +0200 Subject: [PATCH] intcode: make execute current not protected --- 2019/aoc2019/day23.py | 2 +- 2019/aoc2019/intcode.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/2019/aoc2019/day23.py b/2019/aoc2019/day23.py index 989a165..e1c6aff 100644 --- a/2019/aoc2019/day23.py +++ b/2019/aoc2019/day23.py @@ -46,7 +46,7 @@ def part2(data: TextIO) -> int: for computer in computers: try: - computer._execute_current() + computer.execute_current() is_idle = False except IndexError: computer.send_input(-1) diff --git a/2019/aoc2019/intcode.py b/2019/aoc2019/intcode.py index 6b060a1..86777a3 100644 --- a/2019/aoc2019/intcode.py +++ b/2019/aoc2019/intcode.py @@ -70,7 +70,7 @@ class Computer: def run(self) -> None: """ Run until failure """ - while self._execute_current(): + while self.execute_current(): pass def get_output(self) -> int: @@ -79,7 +79,7 @@ class Computer: def send_input(self, data: int): self.input.append(data) - def _execute_current(self) -> bool: + def execute_current(self) -> bool: """ Execute a single instruction :return: True if the program should continue