simulate ( boids behaviors dt -- boids )


Vocabulary
boids.simulation

Inputs
boidsan object
behaviorsan object
dtan object


Outputs
boidsan object


Definition


:: simulate ( boids behaviors dt -- boids )
boids [| boid |
boid boids behaviors
[ [ (force) ] keep weight>> v*n ] 2with map
vsum :> a boid vel>> a dt v*n v+
normalize :> vel boid pos>> vel dt v*n v+
wrap-pos :> pos pos vel <boid>
] map ;