This commit is contained in:
Simon Gardling 2021-04-01 14:06:29 -04:00
parent af0b9f9222
commit 80c0c8c194

View File

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