cleanup
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
use crate::{buffer::Buf, util::wrap};
|
||||
|
||||
use fastapprox::faster::{cos, sin};
|
||||
use rand::{seq::SliceRandom, Rng};
|
||||
use std::f32::consts::TAU;
|
||||
@@ -41,7 +40,6 @@ impl Agent {
|
||||
}
|
||||
|
||||
// Tick an agent
|
||||
#[inline]
|
||||
pub fn tick(
|
||||
&mut self,
|
||||
buf: &Buf,
|
||||
@@ -75,7 +73,9 @@ impl Agent {
|
||||
if (center > left) && (center > right) {
|
||||
direction = 0.0;
|
||||
} else if (center < left) && (center < right) {
|
||||
direction = *[-1.0, 1.0].choose(&mut rng).unwrap();
|
||||
direction = *[-1.0, 1.0]
|
||||
.choose(&mut rng)
|
||||
.expect("unable to choose random direction");
|
||||
} else if left < right {
|
||||
direction = 1.0;
|
||||
} else if right < left {
|
||||
|
||||
Reference in New Issue
Block a user