diff --git a/src/app.rs b/src/app.rs index 203b034..bd0fe24 100644 --- a/src/app.rs +++ b/src/app.rs @@ -53,10 +53,8 @@ impl App { pub fn play_pause(&mut self, prev_poll_t: &mut Duration) { if self.paused() { - // println!("Resuming: poll() = {:?}\r", prev_poll_t); self.poll_t = *prev_poll_t; } else { - // println!("Pausing...\r"); *prev_poll_t = self.poll_t; self.poll_t = Duration::MAX; } @@ -79,7 +77,6 @@ impl App { .checked_sub(self.poll_t.checked_div(div).unwrap_or(DEF_DUR)) .unwrap_or(DEF_DUR); } - // println!("poll time is now: {:?}\r", self.poll_t()); } pub fn slower(&mut self, big: bool) { if !self.paused { @@ -89,7 +86,6 @@ impl App { .checked_add(self.poll_t.checked_div(div).unwrap_or(DEF_DUR)) .unwrap_or(DEF_DUR); } - // println!("poll time is now: {:?}\r", self.poll_t()); } pub fn next(&mut self) { diff --git a/src/kmaps.rs b/src/kmaps.rs index 4050792..f61510c 100644 --- a/src/kmaps.rs +++ b/src/kmaps.rs @@ -3,7 +3,6 @@ use crossterm::event::KeyCode; pub const PLAY_PAUSE: KeyCode = KeyCode::Char(' '); pub const SLOWER: KeyCode = KeyCode::Char('j'); - pub const SLOWER_BIG: KeyCode = KeyCode::Char('J'); pub const FASTER: KeyCode = KeyCode::Char('k'); @@ -18,7 +17,4 @@ pub const RESET: KeyCode = KeyCode::Char('R'); pub const NEXT: KeyCode = KeyCode::Char('n'); pub const PREV: KeyCode = KeyCode::Char('p'); -pub const BIGGER: KeyCode = KeyCode::Char('+'); -pub const SMALLER: KeyCode = KeyCode::Char('-'); - pub const HELP: KeyCode = KeyCode::Char('?'); diff --git a/src/lib.rs b/src/lib.rs index 4006869..42f802d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -73,7 +73,7 @@ impl Universe { } else if ch == '_' || ch == ' ' || ch == '0' { cells.push(Cell::Dead); } else { - eprintln!("Can't do nothing with this character: {ch}"); + eprintln!("can't do nothing with this character: {ch}"); } } } @@ -98,8 +98,6 @@ impl Universe { .filter(|cell| cell == &&Cell::Alive) .count(); - // println!("{}\r", &figur); - if wh < figur.height() || wh < figur.width() { return Err(HandleError::TooBig); } @@ -112,7 +110,6 @@ impl Universe { }; let (start_row, start_col) = ((wh - figur.height()) / 2, (wh - figur.width()) / 2); - // println!("\r"); let mut j = 0; for row in start_row as usize..start_row as usize + figur.height() as usize { @@ -185,22 +182,6 @@ impl Universe { } } -// impl fmt::Display for Universe { -// fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { -// writeln!(f, "╭{}╮\r", "─".repeat(self.width as usize * 2))?; -// for line in self.cells.as_slice().chunks(self.width as usize) { -// write!(f, "│")?; -// for &cell in line { -// let symbol = if cell == Cell::Dead { ' ' } else { '◼' }; // ◻ -// write!(f, "{symbol} ")?; -// } -// writeln!(f, "│\r")?; -// } -// writeln!(f, "╰{}╯\r", "─".repeat(self.width as usize * 2))?; -// Ok(()) -// } -// } - impl fmt::Display for Universe { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { for line in self.cells.as_slice().chunks(self.width as usize) { diff --git a/src/ui.rs b/src/ui.rs index bb056e4..d767f98 100644 --- a/src/ui.rs +++ b/src/ui.rs @@ -19,8 +19,6 @@ pub fn ui(f: &mut Frame, app: &App) { .constraints([Constraint::Min(0), Constraint::Length(1)]) .split(f.size()); - // let current_shape = shapes::get(app.wh, app.i()).unwrap(); - let main_chunks = Layout::default() .direction(Direction::Horizontal) .constraints([Constraint::Percentage(50)]) @@ -32,12 +30,6 @@ pub fn ui(f: &mut Frame, app: &App) { .title("Conway's Game of Life"); let universe = Paragraph::new(app.universe.to_string()).block(cgol); - // let shape = Paragraph::new(current_shape.to_string()).block( - // Block::default() - // .borders(Borders::ALL) - // .border_type(BorderType::Rounded), - // ); - // f.render_widget(universe, Rect::new(0, 0, app.wh() * 2 + 2, app.wh() + 2)); f.render_widget( universe, Rect::new( @@ -47,7 +39,6 @@ pub fn ui(f: &mut Frame, app: &App) { main_chunks[0].height - 1, ), ); - // f.render_widget(shape, main_chunks[1]); let footer = Layout::default() .direction(Direction::Horizontal) @@ -58,7 +49,6 @@ pub fn ui(f: &mut Frame, app: &App) { "[q]uit, [r]estart, [R]eset, [n]ext, [p]revious, play[ ]pause, 'k': faster, 'j': slower", Style::default().fg(Color::Yellow), ); - // let key_notes_footer = Paragraph::new(current_keys_hint); let stat_style = Style::default().fg(Color::LightBlue); let poll_t = Span::styled( @@ -72,21 +62,10 @@ pub fn ui(f: &mut Frame, app: &App) { ), stat_style, ); - // let area_size = Span::styled(format!("Area size: {}", f.size()), stat_style); - // let wh = Span::styled(format!("wh: {:?}", app.wh()), stat_style); let div = Span::styled(" | ", Style::default().fg(Color::White)); - let current_stats = vec![ - current_keys_hint, - div.clone(), - poll_t, - // div.clone(), - // area_size, - // div.clone(), - // wh, - ]; + let current_stats = vec![current_keys_hint, div.clone(), poll_t]; let footer_data = Line::from(current_stats); - // f.render_widget(key_notes_footer, footer[0]); f.render_widget(footer_data, footer[0]); }