 
 (defn update-score []
   (swap! app-state update-in [:score] score))
+
+(defn update-time []
+  (swap! app-state update-in [:time] dec)
+  (js/setTimeout update-time 1000)
+  (when (end-game?)
+    (end-game)))
 
 (defn handle-letter [letter-id status]
   (do

    (swap! app-state update-in [:pos] #(or first-greater-pos first-pos))))


(defn end-game? []
  (every? #(or (= :failed %) (= :ok %)) (:status @app-state)))

(defn end-game []
  (secretary/dispatch! "/end"))

(defn init! []
  (reset-state!)
  (hook-browser-navigation!)
  (hook-keyboard-listener!)
  (hook-clock-update!)
  (mount-root))
