Day 19, part 2
This commit is contained in:
parent
ab870a881e
commit
f825de9426
|
@ -0,0 +1,27 @@
|
|||
use std::thread;
|
||||
|
||||
use aoc22::{day19, util};
|
||||
|
||||
const MINUTES: usize = 32;
|
||||
const MAX_BLUEPRINTS: usize = 3;
|
||||
|
||||
pub fn main() {
|
||||
let blueprints = day19::parse_blueprints(&util::parse_input());
|
||||
assert!(blueprints.len() > 0);
|
||||
|
||||
let mut handles = Vec::new();
|
||||
for blueprint in blueprints.iter().take(MAX_BLUEPRINTS) {
|
||||
let blueprint = blueprint.clone();
|
||||
handles.push(thread::spawn(move || {
|
||||
day19::max_geodes(MINUTES, &blueprint)
|
||||
}));
|
||||
}
|
||||
|
||||
let mut prod = 1;
|
||||
for handle in handles {
|
||||
let max = handle.join().unwrap();
|
||||
prod *= max;
|
||||
}
|
||||
|
||||
println!("Product of geodes: {}", prod);
|
||||
}
|
Loading…
Reference in New Issue