From c8cef9c0ce0055c933dbfa098731f6c6a36a5154 Mon Sep 17 00:00:00 2001 From: Johannes Date: Mon, 3 Oct 2022 09:03:31 +0200 Subject: [PATCH] Extended IntCodeComputer. --- src/tasks/day05.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/tasks/day05.rs b/src/tasks/day05.rs index 169ebd8..88590cb 100644 --- a/src/tasks/day05.rs +++ b/src/tasks/day05.rs @@ -217,6 +217,7 @@ impl IntCodeComputer { op.params[0].store(&mut self.ram, *v, self.relative_base_offset); self.pc += 2; } else { + self.input_storage.clear(); return false; } } @@ -288,6 +289,10 @@ impl IntCodeComputer { } } + pub fn get_input(&self) -> &[i128] { + self.input_storage.as_slice() + } + pub fn clear_output(&mut self) { self.output_storage.clear(); }