collect grids instead

This commit is contained in:
2025-03-28 17:41:24 -04:00
parent 16887c9712
commit 47e09571fc

View File

@@ -75,13 +75,14 @@ impl Model {
} }
} }
let mut grids: Vec<Grid> = Vec::new(); let grids = (0..n_populations)
for _ in 0..n_populations { .map(|_| {
let agents = (0..particles_per_grid) let agents = (0..particles_per_grid)
.map(|_| Agent::new(width, height, &mut rng)) .map(|_| Agent::new(width, height, &mut rng))
.collect(); .collect();
grids.push(Grid::new(width, height, &mut rng, agents)); Grid::new(width, height, &mut rng, agents)
} })
.collect();
Model { Model {
population_grids: grids, population_grids: grids,