2 USING: kernel random math math.constants math.points accessors multi-methods
3 processing processing.shapes
5 bubble-chamber.particle colors ;
7 IN: bubble-chamber.particle.hadron
9 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
11 TUPLE: hadron < particle ;
13 : <hadron> ( -- hadron ) hadron new initialize-particle ;
15 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
17 METHOD: collide { hadron }
20 2 pi * 1random >>theta
21 0.5 3.5 2random >>speed
22 0.996 1.001 2random >>speed-d
26 [ 0.00001 theta-dd-small? ] [ -0.001 0.001 random-theta-dd ] [ ] while
28 0 1 0 1 rgba boa >>myc
32 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
34 METHOD: move { hadron }
55 100 random 70 > [ dup collide ] when
59 out-of-bounds? [ collide ] [ drop ] if ;