From a0c07364d18a48efb4831080687f4643906479cc Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Thu, 27 Mar 2025 23:54:02 -0400 Subject: [PATCH] cleanup agent structs --- src/agent.rs | 14 ++------------ src/model.rs | 4 ++-- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/src/agent.rs b/src/agent.rs index 42f88ef..2fc3a4e 100644 --- a/src/agent.rs +++ b/src/agent.rs @@ -9,9 +9,7 @@ use std::fmt::{Display, Formatter}; pub struct Agent { pub x: f32, pub y: f32, - pub angle: f32, - pub population_id: usize, - pub i: usize, + angle: f32, } impl Display for Agent { @@ -22,20 +20,12 @@ impl Display for Agent { impl Agent { /// Construct a new agent with random parameters. - pub fn new( - width: usize, - height: usize, - id: usize, - rng: &mut R, - i: usize, - ) -> Self { + pub fn new(width: usize, height: usize, rng: &mut R) -> Self { let (x, y, angle) = rng.gen::<(f32, f32, f32)>(); Agent { x: x * width as f32, y: y * height as f32, angle: angle * TAU, - population_id: id, - i, } } diff --git a/src/model.rs b/src/model.rs index d09f0be..37fc209 100644 --- a/src/model.rs +++ b/src/model.rs @@ -73,9 +73,9 @@ impl Model { } let mut grids: Vec = Vec::new(); - for pop in 0..n_populations { + for _ in 0..n_populations { let agents = (0..particles_per_grid) - .map(|i| Agent::new(width, height, pop, &mut rng, i)) + .map(|_| Agent::new(width, height, &mut rng)) .collect(); grids.push(Grid::new(width, height, &mut rng, agents)); }