 
 (defn run-game-cycle
   "Puts everything together."
-  [{:keys [running? tetrimino] :as state}]
-  (if running?
-    (-> state
-        process-time
-        process-keyboard
-        release-keyboard
-        process-gravity
-        maybe-score
-        maybe-level-up
-        maybe-next-tetrimino
-        maybe-game-over)
-    state))
+  [{:keys [mode tetrimino] :as state}]
+  (cond-> state
+          true process-time
+          true process-keyboard
+          true release-keyboard
+          (= mode :game) process-gravity
+          (= mode :game) maybe-score
+          (= mode :game) maybe-level-up
+          (= mode :game) maybe-next-tetrimino
+          (= mode :game) maybe-game-over))
 
 (.addEventListener js/document "keydown" #(swap! game-state handle-key-press (.-keyCode %)) false)
 (render-loop)

(ns tetris.core
  (:require [cljs.core.async :refer [chan >! <! timeout]])
  (:require-macros [cljs.core.async.macros :refer [go go-loop]]))

(def screen-ctx (-> js/document (.getElementById "screen") (.getContext "2d")))
(def preview-ctx (-> js/document (.getElementById "preview-screen") (.getContext "2d")))

                       :gravity-interval 500
                       :score 0
                       :level 1
                       :mode :game}))

(defn time-left
  "Given a timestamp and a time interval, returns a remaining interval
