You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
advent-of-code/2016/rust/src/day_12.rs

13 lines
410 B

use assembunny::*;
use errors::*;
pub fn solve(input: &str) -> Result<String> {
let instructions: Instructions = input.parse()?;
let registers = vec![(Register::C, 1)].into_iter().collect();
let assembunny = Assembunny{registers: registers, instructions: instructions};
let registers = assembunny.last().ok_or("")?;
let a = registers.get(&Register::A).ok_or("")?;
Ok(a.to_string())
}