Extended IntCodeComputer.
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user