day07 task 1
This commit is contained in:
@@ -9,7 +9,7 @@ pub fn run() {
|
||||
task2(ram.clone());
|
||||
}
|
||||
|
||||
struct IntCodeComputer {
|
||||
pub struct IntCodeComputer {
|
||||
input_storage: Vec<i32>,
|
||||
output_storage: Vec<i32>,
|
||||
pc: usize,
|
||||
@@ -140,7 +140,7 @@ impl Op {
|
||||
}
|
||||
|
||||
impl IntCodeComputer {
|
||||
fn new(input: Vec<i32>, memory: Vec<i32>) -> Self {
|
||||
pub fn new(input: Vec<i32>, memory: Vec<i32>) -> Self {
|
||||
IntCodeComputer {
|
||||
input_storage: input,
|
||||
output_storage: Vec::new(),
|
||||
@@ -149,7 +149,7 @@ impl IntCodeComputer {
|
||||
}
|
||||
}
|
||||
|
||||
fn run_until_end(&mut self) {
|
||||
pub fn run_until_end(&mut self) {
|
||||
let mut op = Op::from(self.pc, &self.ram);
|
||||
let mut inputs = self.input_storage.iter();
|
||||
while op.opcode != OpCode::Terminate {
|
||||
@@ -212,7 +212,7 @@ impl IntCodeComputer {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_output(&self) -> &[i32] {
|
||||
pub fn get_output(&self) -> &[i32] {
|
||||
self.output_storage.as_slice()
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user