day09 task 1
This commit is contained in:
18
src/tasks/day09.rs
Normal file
18
src/tasks/day09.rs
Normal 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());
|
||||
}
|
||||
Reference in New Issue
Block a user