- Commit
- 40b7cae777a49cbc6d369b6a003c4324a0b36cd0
- Parent
- 836609a62dd778474a80512994c36840b5b4ac23
- Author
- Gark Garcia <37553739+GarkGarcia@users.noreply.github.com>
- Date
Optimized the progress annotation functionality.
An exercise on polyglossy: the same problem solved on multiple languages
Optimized the progress annotation functionality.
1 file changed, 9 insertions, 9 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Modified | src/main.rs | 18 | 9 | 9 |
diff --git a/src/main.rs b/src/main.rs @@ -57,21 +57,21 @@ fn get_counter_expl(max : i32) -> Vec<[i32; 2]> { let mut load_bar = 0f32; for a in 0..max { + + // Print the progress on the screen + let new_load_bar = ((a as f32) * 100f32 / (max as f32)).ceil(); + if new_load_bar != load_bar { + load_bar = new_load_bar; + clear_console(); + println!("LOADING: {}%", new_load_bar); + } + for b in a..max { let difference : i32 = sum_digits(a + b) - sum_digits(a) - sum_digits(b); if !is_multiple_of_nine(difference) { counter_examples.push([a, b]); } - - // Print the progress on the screen - let new_load_bar = ((a as f32) * 100f32 / (max as f32)).ceil(); - - if new_load_bar != load_bar { - load_bar = new_load_bar; - clear_console(); - println!("LOADING: {}%", new_load_bar); - } } }