 (defn play-sound [result]
   (when (.-HTMLAudioElement js/window)
     (let [sounds {:failed "sad" :completed "success"}] 
-    (println "playing " (sounds result))
+;;    (println "playing " (sounds result))
     (let [audio-obj (js/Audio. (str "sounds/" (sounds result) ".mp3"))]
     (reset! playing audio-obj) 
     (.play audio-obj )))))
 
 
-(defn update-timer [state timer]
-  (let [game @state]
-    (println "timer triggered")
+(defn update-timer []
+  (let [game @game-state]
+;;    (println "timer triggered")
     (when-not (or (game :first) (game :end))
-      (println "Changed seconds")
-      (reset! timer (quot (.getTime (js/Date.)) 1000)))))
+;;      (println "Changed seconds")
+      (set-tick))))
 
 
 (defn stop-sound [] (when-let [ audio-obj @playing] (.pause audio-obj)))



(defn first-click [game x y]
  (reset! time-tick (quot (.getTime (js/Date.)) 1000))
  (if (= 1 (get-in game [:board x y]) )
    (swap-cell game [x y] (find-space game))
    game))

  (let [game (if (game :first) 
               (-> game
                (first-click x y)
                (assoc :start (.getTime (js/Date.)) )
                (assoc :first false))
               game) ]
    (condp = (get-in game [:state x y])
