BIG rewrite and changes (too many to list)
This commit is contained in:
13
src/model.rs
13
src/model.rs
@@ -118,23 +118,16 @@ impl Model {
|
||||
// Combine grids
|
||||
let grids = &mut self.grids;
|
||||
combine(grids, &self.attraction_table);
|
||||
let grids_immutable_1 = &grids.clone();
|
||||
|
||||
let agents_tick_time = Instant::now();
|
||||
|
||||
// Tick agents
|
||||
for grid in grids.iter_mut() {
|
||||
grid.agents.par_iter_mut().for_each(|agent| {
|
||||
agent.tick(&grids_immutable_1[agent.population_id]);
|
||||
});
|
||||
grid.tick();
|
||||
}
|
||||
|
||||
// Deposit
|
||||
let grids_immutable_2 = &grids.clone();
|
||||
for grid in grids_immutable_2.iter() {
|
||||
for agent in grid.agents.iter() {
|
||||
self.grids[agent.population_id].deposit(agent.x, agent.y);
|
||||
}
|
||||
for grid in self.grids.iter_mut() {
|
||||
grid.deposit_all();
|
||||
}
|
||||
|
||||
// Diffuse + Decay
|
||||
|
||||
Reference in New Issue
Block a user