things
This commit is contained in:
17
src/grid.rs
17
src/grid.rs
@@ -161,9 +161,22 @@ impl Grid {
|
||||
|
||||
#[inline]
|
||||
pub fn tick(&mut self) {
|
||||
let self_immutable = self.clone();
|
||||
let (width, height) = (self.width, self.height);
|
||||
let PopulationConfig {
|
||||
sensor_distance,
|
||||
sensor_angle,
|
||||
rotation_angle,
|
||||
step_distance,
|
||||
..
|
||||
} = self.config;
|
||||
|
||||
let self_imut = self.clone(); // Create immutable copy of self before ticking agents (this is a very bad solution, needs to be improved)
|
||||
|
||||
self.agents.par_iter_mut().for_each(|agent| {
|
||||
agent.tick(&self_immutable);
|
||||
agent.tick(&self_imut,
|
||||
sensor_distance, sensor_angle,
|
||||
rotation_angle, step_distance,
|
||||
width, height);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user