         ))
 
 (def my-code-url "https://github.com/pauldoo/scratch/blob/master/ClojureScript/hello.cljs")
+(def width-in-px 800)
+(def height-in-px 300)
 (def tick-step (/ 1 100))
 (def render-step (/ 1 25))
 (def gravity-strength 300)
 (def ground-strength 100)
-(def initial-game-state {
-    :nodes {
-        :t {
-            :pos [50 100]
-            :vel [0 0]
-        }
-        :u {
-            :pos [250 200]
-            :vel [0 0]
-        }
-        :v {
-            :pos [150 100]
-            :vel [0 0]
-        }
-    }
-    :springs [
-        {
-            :node-a :t
-            :node-b :u
-            :rest-length 224.0
-            :strength 2000
-        }
-        ;{
-        ;    :node-a :u
-        ;    :node-b :v
-        ;    :rest-length 141.0
-        ;    :strength 2000
-        ;}
-        {
-            :node-a :t
-            :node-b :v
-            :rest-length 100.0
-            :strength 2000
-        }
-    ]
-    :hinges [
-        {
-            :node-a :u
-            :node-b :t
-            :node-c :v
-            :rest-angle (/ Math/PI 2)
-            :strength 100000
-        }
-    ]
-    })
 
 (defn print-to-log [v]
     (.log js/console v))

(def magnitude (comp Math/sqrt magnitude-squared))
(def normalize (comp (partial apply vec*) (juxt identity (comp (partial / 1.0) magnitude))))
(defn dot-product [v w] (apply + (map * v w)))
(defn clamp [v lower upper] (Math/min (Math/max v lower) upper))
(defn angle [v w] (Math/acos (clamp
    (dot-product (normalize v) (normalize w))
    -1.0 1.0 )))
(defn rot-cw [[x y]] [y (- x)])
(defn rot-ccw [[x y]] [(- y) x])

(defn calculate-force [node-a node-b rest-length strength]
    (let [a-b (vec- node-a node-b)


(defn rerender [canvas-element game-state]
    (let [
        graphics (graphics/createGraphics width-in-px height-in-px)
        {nodes :nodes springs :springs} game-state]
        (do
            (apply draw-line graphics (apply concat (map world-to-screen [[0 0] [width-in-px 0]])))
            (dorun (map
                (fn [{a :node-a b :node-b}]
                    (let [
