diff --git a/src/tasks/day10.rs b/src/tasks/day10.rs index 8cd18f2..24a3da6 100644 --- a/src/tasks/day10.rs +++ b/src/tasks/day10.rs @@ -27,20 +27,22 @@ pub fn task1() { // } let mut old_area = get_area(&lights); + let mut time = 0; loop { + time += 1; let new_lights = lights.iter().map(|light| light.move_copy()).collect(); // print_lights(&new_lights); let new_area = get_area(&new_lights); // println!("Area: {} ", new_area); if new_area > old_area { - println!("Found a minimum.."); - print_lights(&lights); break; } else { lights = new_lights; old_area = new_area; } } + println!("Found a minimum after {} seconds", time - 1); + print_lights(&lights); } fn get_area(lights: &Vec) -> usize {