y2024d17p2 still not done
This commit is contained in:
parent
27a236f958
commit
b410fa49ca
@ -62,14 +62,19 @@ pub fn process_part2(input: &str) -> u32 {
|
|||||||
})
|
})
|
||||||
.collect_vec()
|
.collect_vec()
|
||||||
.concat();
|
.concat();
|
||||||
|
let mut a = 0;
|
||||||
loop {
|
loop {
|
||||||
|
registers.insert("A", a);
|
||||||
let out = exec_program(instructions.clone(), &mut registers);
|
let out = exec_program(instructions.clone(), &mut registers);
|
||||||
if out == orig {
|
if out == orig {
|
||||||
|
println!("{orig:?}");
|
||||||
|
println!("{out:?}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
a += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
*registers.get("A").unwrap()
|
a
|
||||||
}
|
}
|
||||||
|
|
||||||
fn exec_program(instructions: Vec<(&str, &str)>, registers: &mut HashMap<&str, u32>) -> Vec<u32> {
|
fn exec_program(instructions: Vec<(&str, &str)>, registers: &mut HashMap<&str, u32>) -> Vec<u32> {
|
||||||
|
Loading…
Reference in New Issue
Block a user