From b565771db265ddfff114ce4cc6f9f31783756900 Mon Sep 17 00:00:00 2001 From: lemon-cat Date: Sat, 30 May 2026 15:54:36 +0300 Subject: [PATCH] one ant is lazy --- src/console_render/mod.rs | 2 +- src/main.rs | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/console_render/mod.rs b/src/console_render/mod.rs index 66979c7..946104d 100644 --- a/src/console_render/mod.rs +++ b/src/console_render/mod.rs @@ -83,7 +83,7 @@ impl Render { } pub fn frame(&mut self, grid: &TorusGrid, a_grid: &TorusGrid>) { let mut out = self.out.lock(); - _ = queue!(out, MoveTo(0, 0)); + _ = queue!(out, Clear(ClearType::All), MoveTo(0, 0)); for i in 0..self.rez.0 { for j in 0..self.rez.1 { let ca: Color; diff --git a/src/main.rs b/src/main.rs index cdf283e..e128957 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,13 +24,15 @@ fn main() { let rez: (usize, usize) = (100, 100); let mut w = world::World::new(rez); - for i in 0..rez.0 { - for j in 0..rez.1 { - if let Some(a) = w.get_mut_grid().get_mut((i as i32, j as i32)) { - *a = rnd.gen_range(0..=1) == 1; + /* + for i in 0..rez.0 { + for j in 0..rez.1 { + if let Some(a) = w.get_mut_grid().get_mut((i as i32, j as i32)) { + *a = rnd.gen_range(0..=1) == 1; + } } } - } + */ for mut i in 0..20 { let x = rnd.gen_range(0..=rez.0) as i32; @@ -45,6 +47,7 @@ fn main() { loop { //R.clear(); R.frame(w.get_grid(), w.get_a_grid()); + R.print(&w.debug()); match it { InputType::comand => { R.print("Input your comand: ");