Complete day5 part2
This commit is contained in:
parent
177fdba129
commit
96b41d2d0c
1 changed files with 7 additions and 5 deletions
|
@ -103,12 +103,13 @@ fn main() {
|
|||
calculated_locations.push(thread::spawn(move ||{
|
||||
let seed = cloned_seed;
|
||||
let mut final_location = usize::MAX;
|
||||
for i in seed.first_val..(seed.first_val+seed.range){
|
||||
for i in seed.first_val..=(seed.first_val+seed.range){
|
||||
let mut calc_location = i;
|
||||
for map in map_ref.iter(){
|
||||
let calc_location = map.convert(i);
|
||||
if calc_location < final_location{
|
||||
final_location = calc_location;
|
||||
}
|
||||
calc_location = map.convert(calc_location);
|
||||
}
|
||||
if calc_location <= final_location && calc_location != 0{
|
||||
final_location = calc_location;
|
||||
}
|
||||
}
|
||||
println!("Finished with seed: {:?}",seed);
|
||||
|
@ -124,6 +125,7 @@ fn main() {
|
|||
}
|
||||
}
|
||||
|
||||
println!("");
|
||||
println!("{}",final_output);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue