         new-board (into (vec (repeat n empty-row)) cleared-board)]
     (swap! state assoc :board new-board)))
 
+(defn go-go-collapse!
+  []
+  (let [board (:board @state)
+        rows (get-filled-row-indices board)]
+
+    (js/console.log "Collapsing?")
+    (when (> (count rows) 0)
+      (js/console.log "YES")
+      (swap! state assoc :animating true)
+      (go
+        ; blink n times
+        (doseq [i (range 3)]
+          (js/console.log "Blink" i)
+
+          (<! (timeout 100))                            ; resume here in 0.5 seconds
+          (swap! state assoc :highlighted-rows rows)    ; highlight rows
+          (<! (timeout 100))                            ; resume here in 0.5 seconds
+          (swap! state assoc :highlighted-rows #{}))     ; unhighlight rows
+
+        ; finally collapse
+        (js/console.log "Collapsing.")
+        (collapse-rows!)
+        (swap! state assoc :animating false)))))
+
 (defn lock-piece!
   "Lock the current piece into the board."
   []

        coords (:coords piece)]
    (write-coords-to-board coords x y value board)))

(defn rotate-piece
  "Create a new piece by rotating the given piece clockwise."
  [piece]

        piece (:piece @state)
        board (:board @state)]
    (swap! state assoc :board (write-piece-to-board piece x y board))
    (go-go-collapse!)
    (spawn-piece!)))

(defn go-go-gravity!
