day09 task 2

This commit is contained in:
Johannes
2019-12-09 23:04:03 +01:00
parent 17e0eea8dc
commit 3917746851

View File

@@ -8,6 +8,7 @@ pub fn run() {
.map(|(i, s)| (i, s.parse::<i128>().unwrap())) .map(|(i, s)| (i, s.parse::<i128>().unwrap()))
.collect(); .collect();
task1(ram.clone()); task1(ram.clone());
task2(ram.clone());
} }
fn task1(ram: RAM) { fn task1(ram: RAM) {
@@ -16,3 +17,10 @@ fn task1(ram: RAM) {
println!("{:?}", computer.get_output()); println!("{:?}", computer.get_output());
println!("Task 1: {}", computer.get_output().last().unwrap()); println!("Task 1: {}", computer.get_output().last().unwrap());
} }
fn task2(ram: RAM) {
let mut computer = IntCodeComputer::new(vec![2], ram);
computer.run_until_end();
println!("{:?}", computer.get_output());
println!("Task 2: {}", computer.get_output().last().unwrap());
}