Extended IntCodeComputer.

This commit is contained in:
2022-10-03 09:03:31 +02:00
parent 420b6152fb
commit c8cef9c0ce

View File

@@ -217,6 +217,7 @@ impl IntCodeComputer {
op.params[0].store(&mut self.ram, *v, self.relative_base_offset); op.params[0].store(&mut self.ram, *v, self.relative_base_offset);
self.pc += 2; self.pc += 2;
} else { } else {
self.input_storage.clear();
return false; 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) { pub fn clear_output(&mut self) {
self.output_storage.clear(); self.output_storage.clear();
} }