Function aoc::y15d12::y15d12

source ·
pub fn y15d12(input: &str, ignore_red: bool) -> i64
Expand description

The solution for the day twelve challenge.

Given the input string and a boolean whether or not we should ignore objects that have a value red we pass everything off to the calculate value function which can call itself recursively to calculate the total sum.

§Example

// probably read this from the input file...
let input = "[1,{\"a\":\"red\",\"b\":2}]";
assert_eq!(y15d12(input, false), 3);
assert_eq!(y15d12(input, true), 1);