 ! Copyright (C) 2007 Alex Chapman
 ! See http://factorcode.org/license.txt for BSD license.
-USING: accessors colors jamshred.log jamshred.oint jamshred.sound jamshred.tunnel kernel math math.constants math.order math.ranges shuffle sequences system ;
+USING: accessors colors combinators jamshred.log jamshred.oint jamshred.sound jamshred.tunnel kernel math math.constants math.order math.ranges shuffle sequences system ;
 IN: jamshred.player
 
 TUPLE: player < oint name sounds tunnel nearest-segment last-move speed ;


: ?bounce ( distance-remaining player -- )
    over 0 > [
        [ dup nearest-segment>> bounce ] [ sounds>> bang ]
        [ (move-player) ] tri
    ] [
        2drop
    ] if ;

: change-player-speed ( inc player -- )
    [ + speed-range clamp-to-range ] change-speed drop ;

: multiply-player-speed ( n player -- )
    [ * speed-range clamp-to-range ] change-speed drop ; 

: distance-to-move ( player -- distance )
    [ speed>> ] [ last-move>> millis dup >r swap - 1000 / * r> ]
    [ (>>last-move) ] tri ;
