A simple actor-based simulation of tag, implemented in rust.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

16 lines
472 B

3 years ago
3 years ago
3 years ago
  1. pub mod agent;
  2. pub mod view;
  3. pub mod world;
  4. use agent::{Agent, SimpleAgent};
  5. use world::ActualWorld;
  6. pub fn get_world(width: isize, height: isize, spacing: usize, validating: bool) -> ActualWorld {
  7. let mut agents: Vec<(_, Box<dyn Agent>)> = vec![];
  8. for x in (0..width).step_by(spacing) {
  9. for y in (0..height).step_by(spacing) {
  10. agents.push(((x, y).into(), Box::new(SimpleAgent)));
  11. }
  12. }
  13. ActualWorld::new((width, height).into(), agents, validating)
  14. }