 
 (defn init []
   (size-canvas!)
-  (spawn-piece!)
+  (try-spawn-piece!)
   (add-key-events)
   (go-go-gravity!)
 

  []
  (js/console.log "game over"))

(defn spawn-piece!
  "Spawns a random piece at the starting position."
  []
  (let [piece (get-rand-piece)
        [x y] start-position
        board (:board @state)]
    (if (piece-fits? piece x y board)
      (swap! state assoc :piece (get-rand-piece)
                     :position start-position)
      (game-over))
  ))

(defn collapse-rows!
  "Collapse all filled rows."

    ; If collapse routine returns a channel...
    ; then wait for it before spawning a new piece.
    (if-let [collapse-anim (go-go-collapse!)]
      (go (<! collapse-anim) (try-spawn-piece!))
      (try-spawn-piece!))))

(defn go-go-gravity!
  "Starts the gravity routine."
