diff --git a/src/model.rs b/src/model.rs index 746edb4..204c306 100644 --- a/src/model.rs +++ b/src/model.rs @@ -75,13 +75,14 @@ impl Model { } } - let mut grids: Vec = Vec::new(); - for _ in 0..n_populations { - let agents = (0..particles_per_grid) - .map(|_| Agent::new(width, height, &mut rng)) - .collect(); - grids.push(Grid::new(width, height, &mut rng, agents)); - } + let grids = (0..n_populations) + .map(|_| { + let agents = (0..particles_per_grid) + .map(|_| Agent::new(width, height, &mut rng)) + .collect(); + Grid::new(width, height, &mut rng, agents) + }) + .collect(); Model { population_grids: grids,