diff --git a/src/lib.rs b/src/lib.rs index f4ba37f..d05027d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,6 +9,8 @@ pub const HELP: &str = r#"Blocking poll() & non-blocking read() - `j`, `k`: decreasing, increasing speed - press Space to pause, play - hit `n` to switch to next shape + - if you want to restart, push `r` + - to reset everything to starting phase, hit `R` - and now, press Enter to continue "#; @@ -238,7 +240,7 @@ pub fn get_shape(wh: u32, i: usize) -> Result { 6 => Universe::from_figur(wh, &shapes::bonk_tie()), - 7 => Universe::from_figur(wh, &shapes::banana_spark()), + 7 => Universe::from_figur(wh, &shapes::acorn()), _ => Err(ShapeError::OutOfRange), } diff --git a/src/main.rs b/src/main.rs index c52dc61..b94b535 100644 --- a/src/main.rs +++ b/src/main.rs @@ -52,47 +52,22 @@ fn print_events() -> io::Result<()> { println!("Quitting...\r"); break; } else if kmaps::slower().contains(&event) { - // if poll_t < Duration::from_millis(40) { - // poll_t = poll_t - // .checked_add(Duration::from_millis(1)) - // .unwrap_or(DEFAULT_DUR); - // } else { - // poll_t = poll_t - // .checked_add(Duration::from_millis(10)) - // .unwrap_or(DEFAULT_DUR); - // } if !paused { slower(&mut poll_t, false); } - // queue!(io::stdout(), Print("Poll time is now"))?; println!("poll time is now: {:?}\r", poll_t); } else if kmaps::faster().contains(&event) { - // if poll_t < Duration::from_millis(40) { - // poll_t = poll_t - // .checked_sub(Duration::from_millis(1)) - // .unwrap_or(DEFAULT_DUR); - // } else { - // poll_t = poll_t - // .checked_sub(Duration::from_millis(10)) - // .unwrap_or(DEFAULT_DUR); - // } if !paused { faster(&mut poll_t, false); } println!("poll time is now: {:?}\r", poll_t); } else if kmaps::slower_big().contains(&event) { - // poll_t = poll_t - // .checked_add(Duration::from_millis(100)) - // .unwrap_or(Duration::from_millis(400)); if !paused { slower(&mut poll_t, true); } println!("poll time is now: {:?}\r", poll_t); } else if kmaps::faster_big().contains(&event) { - // poll_t = poll_t - // .checked_sub(Duration::from_millis(100)) - // .unwrap_or(Duration::from_millis(400)); if !paused { faster(&mut poll_t, true); } @@ -144,9 +119,9 @@ fn print_events() -> io::Result<()> { } } else { // Timeout expired, updating life state - universe.tick(); execute!(io::stdout(), MoveTo(0, 0), Clear(ClearType::FromCursorDown))?; println!("{}", universe); + universe.tick(); } } diff --git a/src/shapes.rs b/src/shapes.rs index a9a01cf..c1e77d4 100644 --- a/src/shapes.rs +++ b/src/shapes.rs @@ -90,9 +90,9 @@ pub fn bonk_tie() -> Vec { .to_vec() } -/// 2×3 -pub fn banana_spark() -> Vec { - ["#_".into(), "_#".into(), "_#".into()].to_vec() +/// 7×3 +pub fn acorn() -> Vec { + ["_#_____".into(), "___#___".into(), "##__###".into()].to_vec() } pub fn rand(width: u32, height: u32) -> Universe {