From cdc66c4793fcbabc264d8eb6d2e6d6e6a3669e79 Mon Sep 17 00:00:00 2001 From: WanderingPenwing Date: Tue, 3 Dec 2024 17:47:23 +0100 Subject: [PATCH] grid progress display --- src/main.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index 7cf643d..c7fb28d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -378,7 +378,16 @@ impl Sudoku { } if self.grid_display { - self.display(ui::DisplayMode::Full); + if !self.debug_display { + let height = self.size + self.square_size + 2; + print!("\x1b[{}A", height); + for _ in 0..height { + println!("{}"," ".repeat((self.size + self.square_size - 1)*2 + 5)); + } + println!(); + print!("\x1b[{}A", height); + } + self.display(ui::DisplayMode::Full); } self.collapse()?; @@ -404,7 +413,9 @@ impl Sudoku { } let elapsed = now.elapsed(); println!("# finished in {} propagations ({} forced collapse), {:.2?} ({:.2?}/propagation)", propagation_counter, collapse_counter, elapsed, elapsed/(propagation_counter as u32)); - self.display(ui::DisplayMode::Full); + if !self.grid_display || self.debug_display { + self.display(ui::DisplayMode::Full); + } Ok(()) }