                       :flappy-start-time 0
                       :flappy-y   start-y
                       :pillar-list
-                      [{:start-time 0
-                        :pos-x 900
-                        :gap-top 200 }]})
-
-(defn reset-state [{:keys [event-chan] :as st} cur-time]
+                      [{ :start-time 0
+                         :pos-x 900
+                         :cur-x 900
+                         :gap-top 200 }]})
+
+(defn reset-state [_ cur-time]
   (-> starting-state
       (update-in [:pillar-list] (fn [pls] (map #(assoc % :start-time cur-time) pls)))
       (assoc
           :start-time cur-time
           :flappy-start-time cur-time
-          :event-chan event-chan
           :timer-running true)))
 
 (fw/defonce flap-state (atom starting-state))
-
-(defmulti transform first)
-
-(defmethod transform :default [_ state] state)
 
 (defn curr-pillar-pos [cur-time {:keys [pos-x start-time] }]
   (translate pos-x horiz-vel (- cur-time start-time)))

          :jump-count (inc jump-count)
          :flappy-start-time cur-time
          :initial-vel jump-vel)))

(defmethod transform :jump [_ state]
  (jump state))

(defn start-game [event-chan]
  (.requestAnimationFrame js/window (fn [time]
                                      (put! event-chan [:start-game time]))))

(defmethod transform :start-game [[_ time] state]
  (reset-state state time))

;; derivatives


   [cljs.core.async :refer [<! chan sliding-buffer put! close! timeout]])
  (:require-macros
   [cljs.core.async.macros :refer [go-loop go]]))

(enable-console-print!)

(defn floor [x] (.floor js/Math x))

(defn translate [start-pos vel time]
  (floor (+ start-pos (* time vel))))

(def horiz-vel -0.15)
(def gravity 0.05)
