 ! See http://factorcode.org/license.txt for BSD license
 
 USING: accessors arrays assocs bit-arrays calendar circular
-colors.constants fry kernel locals math math.order namespaces
-opengl random sequences timers ui ui.commands ui.gadgets
-ui.gadgets.toolbar ui.gadgets.tracks ui.gestures ui.render words
-;
+colors.constants combinators fry kernel locals math math.order
+math.ranges namespaces opengl random sequences timers ui
+ui.commands ui.gadgets ui.gadgets.toolbar ui.gadgets.tracks
+ui.gestures ui.render words ;
 
 IN: game-of-life
 
 : make-grid ( rows cols -- grid )
     '[ _ <bit-array> <circular> ] replicate <circular> ;
-
-: glider ( grid -- grid )
-    { { 2 1 } { 3 2 } { 1 3 } { 2 3 } { 3 3 } }
-    [ first2 pick nth t -rot set-nth ] each ;
 
 : grid-dim ( grid -- rows cols )
     [ length ] [ first length ] bi ;

        ] each-index
    ] each-index ;

TUPLE: grid-gadget < gadget grid timer ;

: <grid-gadget> ( grid -- gadget )
    grid-gadget new
        swap >>grid
        dup '[ _ [ grid>> next-step ] [ relayout-1 ] bi ]
        f 1/5 seconds <timer> >>timer ;


    gadget relayout-1 ;

:: com-glider ( gadget -- )
    gadget grid>> :> grid
    { { 2 1 } { 3 2 } { 1 3 } { 2 3 } { 3 3 } }
    [ first2 grid nth t -rot set-nth ] each
    gadget relayout-1 ;

grid-gadget "toolbar" f {
