day09 task 1

This commit is contained in:
Johannes
2019-12-09 23:02:09 +01:00
parent 2dc626e227
commit 17e0eea8dc
2 changed files with 19 additions and 0 deletions

18
src/tasks/day09.rs Normal file
View File

@@ -0,0 +1,18 @@
use super::day05::{IntCodeComputer, RAM};
pub fn run() {
let input = std::fs::read_to_string("input/day09.txt").unwrap();
let ram: RAM = input
.split(",")
.enumerate()
.map(|(i, s)| (i, s.parse::<i128>().unwrap()))
.collect();
task1(ram.clone());
}
fn task1(ram: RAM) {
let mut computer = IntCodeComputer::new(vec![1], ram);
computer.run_until_end();
println!("{:?}", computer.get_output());
println!("Task 1: {}", computer.get_output().last().unwrap());
}