boids: Use 'math.ranges'

db4
Eduardo Cavazos 2008-11-29 20:25:27 -06:00
parent 06821bcb07
commit 6395204720
1 changed files with 2 additions and 3 deletions

View File

@ -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> ;