 ! by Bill Mill.
 
 : clamp-to-interval ( x interval -- x )
-    [ from>> first max ] [ to>> first min ] bi ;
+    [ from>> first ] [ to>> first ] bi clamp ;
 
 TUPLE: play-field < rectangle ;
 

math.rectangles math.vectors namespaces opengl opengl.gl
opengl.glu processing.shapes sequences sequences.generalizations
shuffle threads ui ui.gadgets ui.gestures ui.render ;
FROM: multi-methods => GENERIC: METHOD: ;
FROM: syntax => M: ;
IN: pong

! Inspired by this Ruby/Shoes version by why: http://gist.github.com/26431


GENERIC: draw ( obj -- )

M: paddle draw [ bottom-left ] [ dim>> ] bi draw-rectangle ;

M: ball draw [ pos>> ] [ diameter>> 2 / ] bi draw-circle ;

TUPLE: pong-gadget < gadget paused field ball player computer ;

