use gntag::agent::{Agent, SimpleAgent}; use gntag::view::TerminalView; use gntag::world::ActualWorld; fn main() { let mut view = TerminalView::try_new().unwrap(); loop { let (width, height) = view.content_size().unwrap(); let mut agents: Vec<(_, Box)> = vec![]; for x in (0..width).step_by(10) { for y in (0..height).step_by(10) { agents.push(((x, y).into(), Box::new(SimpleAgent))); } } let mut world = ActualWorld::new((width, height).into(), agents); let mut gen = 0; loop { let resized = view .draw( gen, world .agent_positions .get(&world.tagged) .map(|pos| (pos.x, pos.y)) .unwrap(), world .agent_positions .iter() .map(|(_id, pos)| (pos.x, pos.y)) .collect::>() .as_ref(), ) .unwrap(); if resized { break; }; world.do_step(); gen += 1; } } }