y2024d17p2 still not done

This commit is contained in:
Fabian Schmidt 2024-12-17 15:12:58 +01:00
parent 27a236f958
commit b410fa49ca

View File

@ -62,14 +62,19 @@ pub fn process_part2(input: &str) -> u32 {
})
.collect_vec()
.concat();
let mut a = 0;
loop {
registers.insert("A", a);
let out = exec_program(instructions.clone(), &mut registers);
if out == orig {
println!("{orig:?}");
println!("{out:?}");
break;
}
a += 1;
}
*registers.get("A").unwrap()
a
}
fn exec_program(instructions: Vec<(&str, &str)>, registers: &mut HashMap<&str, u32>) -> Vec<u32> {