summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <curtis.mcenroe@adgear.com>2016-12-23 13:49:22 -0500
committerJune McEnroe <curtis.mcenroe@adgear.com>2016-12-23 13:49:22 -0500
commit5d60ed699b930b2cb22c665fd54d6a27763b07d9 (patch)
treeb768f9a184d7f0bb2762aa048d9212332314057d
parentDay 23 (diff)
downloadaoc-5d60ed699b930b2cb22c665fd54d6a27763b07d9.tar.gz
aoc-5d60ed699b930b2cb22c665fd54d6a27763b07d9.zip
Day 23 part 2
-rw-r--r--src/bin/day23.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/bin/day23.rs b/src/bin/day23.rs
index 3546dd5..4a54983 100644
--- a/src/bin/day23.rs
+++ b/src/bin/day23.rs
@@ -125,9 +125,9 @@ impl Vm {
     }
 }
 
-fn solve(input: &str) -> i32 {
+fn solve(initial: i32, input: &str) -> i32 {
     let mut vm = Vm::from(input);
-    vm.registers[0] = 7;
+    vm.registers[0] = initial;
     while vm.step() { }
     vm.registers[0]
 }
@@ -136,7 +136,8 @@ fn main() {
     let mut input = String::new();
     io::stdin().read_to_string(&mut input).unwrap();
 
-    println!("Part 1: {}", solve(&input));
+    println!("Part 1: {}", solve(7, &input));
+    println!("Part 2: {}", solve(12, &input));
 }
 
 #[test]