Function advent_solutions::advent2017::day08::part2
[−]
[src]
pub fn part2(instructions: &[Instruction]) -> isize
To be safe, the CPU also needs to know the highest value held in any
register during this process so that it can decide how much memory to
allocate to these operations. For example, in the above instructions,
the highest value ever held was 10 (in register c after the third
instruction was evaluated).
let input = b"b inc 5 if a > 1 a inc 1 if b < 5 c dec -10 if a >= 1 c inc -20 if c == 10 "; let instructions = Instruction::list_from_bytes(input) .to_result() .unwrap(); assert_eq!(part2(&instructions), 10);