boids: Use 'math.ranges'
parent
06821bcb07
commit
6395204720
|
@ -6,6 +6,7 @@ USING: kernel namespaces
|
|||
math.order
|
||||
math.vectors
|
||||
math.trig
|
||||
math.ranges
|
||||
combinators arrays sequences random vars
|
||||
combinators.lib
|
||||
combinators.short-circuit
|
||||
|
@ -61,11 +62,9 @@ VAR: separation-radius
|
|||
! random-boid and random-boids
|
||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
: random-range ( a b -- n ) 1+ over - random + ;
|
||||
|
||||
: random-pos ( -- pos ) world-size> [ random ] map ;
|
||||
|
||||
: random-vel ( -- vel ) 2 [ drop -10 10 random-range ] map ;
|
||||
: random-vel ( -- vel ) 2 [ drop -10 10 [a,b] random ] map ;
|
||||
|
||||
: random-boid ( -- boid ) random-pos random-vel <boid> ;
|
||||
|
||||
|
|
Loading…
Reference in New Issue