- commit
- 5658dccc44a9d60cfdc2d3e75311aa73eddac4e0
- parent
- 59da123619baf6752aded655d1be8d69c8e7c2d0
- Author
- Tobias Bengfort <tobias.bengfort@posteo.de>
- Date
- 2022-02-07 16:31
use constant for STEPS
Diffstat
| M | flood.rs | 5 | +++-- |
1 files changed, 3 insertions, 2 deletions
diff --git a/flood.rs b/flood.rs
@@ -3,6 +3,7 @@ use std::io::Write; 3 3 4 4 const WIDTH: usize = 18; 5 5 const HEIGHT: usize = 18; -1 6 const STEPS: u8 = 32; 6 7 7 8 extern "C" { 8 9 fn getrandom(buf: *mut u8, buflen: usize, flags: u32) -> isize; @@ -79,7 +80,7 @@ fn render(map: &[u8; WIDTH * HEIGHT]) { 79 80 } 80 81 81 82 fn render_status(step: u8) {82 -1 print!("{}/{}", step, 32);-1 83 print!("{}/{}", step, STEPS); 83 84 // move to column 84 85 print!("\x1b[{}G", WIDTH * 2 - 6 * 3 + 2); 85 86 for i in 0..6 { @@ -123,7 +124,7 @@ fn play(seed: u64) -> bool { 123 124 map[i] = rng.gen_range(0, 6); 124 125 } 125 126126 -1 for step in 0..32 {-1 127 for step in 0..STEPS { 127 128 // clear screen and move cursor to top left 128 129 print!("\x1b[2J\x1b[H"); 129 130 render_status(step);