         game-state-ref (atom initial-game-state)
         input-state-ref (atom {:keys (set)})
         canvas (dom/createDom "div" {} "")
-        button (dom/createDom "button" {} "Click!")
         tick-timer (goog.Timer. (Math/round (* 1000 tick-step)))
         render-timer (goog.Timer. (Math/round (* 1000 render-step)))
         ]

    (assoc state
        :hinges
            (let
                [[q w i o a s k l] (map (:keys input-state) [
                    KeyCodes/Q KeyCodes/W KeyCodes/I KeyCodes/O
                    KeyCodes/A KeyCodes/S KeyCodes/K KeyCodes/L
                    ])]
                (map (fn [h] (let [hn (hinge-nodes h)]
                    (assoc h :modifier-angle
                        (clamp (+ (:modifier-angle h)
                            (cond
                                (= hn [:tail :head :h-l-k])
                                    (+ (if q 0.05 0.0) (if w -0.05 0.0))
                                (= hn [:head :h-l-k :h-l-f])
                                    (+ (if i 0.05 0.0) (if o -0.05 0.0))
                                (= hn [:tail :head :h-t-k])
                                    (+ (if q -0.05 0.0) (if w 0.05 0.0))
                                (= hn [:head :h-t-k :h-t-f])
                                    (+ (if i -0.05 0.0) (if o 0.05 0.0))
                                (= hn [:head :tail :t-l-k])
                                    (+ (if a 0.05 0.0) (if s -0.05 0.0))
                                (= hn [:tail :t-l-k :t-l-f])
                                    (+ (if k 0.05 0.0) (if l -0.05 0.0))
                                (= hn [:head :tail :t-t-k])
                                    (+ (if a -0.05 0.0) (if s 0.05 0.0))
                                (= hn [:tail :t-t-k :t-t-f])
                                    (+ (if k -0.05 0.0) (if l 0.05 0.0))
                                :else
                                    0.0))
                            (:min-modifier-angle h) (:max-modifier-angle h)))))

(def tick-step (/ 1 100))
(def render-step (/ 1 25))
(def gravity-strength 300)
(def ground-rebound-strength 200)
(def ground-grip-strength 50)
(def drag-factor 5)

(defn print-to-log [v]
    (.log js/console v))
