diff --git a/src/model.rs b/src/model.rs index 6e47c0e..7f42ee3 100644 --- a/src/model.rs +++ b/src/model.rs @@ -76,12 +76,14 @@ impl Model { } let mut grids: Vec = Vec::new(); - for _ in 0..n_populations { + for pop in 0..n_populations { 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)); - } + Model { grids, attraction_table,