     :update #'update-boids
     :middleware [m/fun-mode]
     :draw #'draw
-    :size [1000 800]
-    :mouse-moved mouse-moved))
+    :size [(- (aget js/window "innerWidth") 40) (- (aget js/window "innerHeight") 100)]
+    :mouse-moved mouse-moved
+    :mouse-clicked mouse-clicked))
 
 (boids-sketch)

    {:boids     boids
     :obstacles [
                 {:position (multiply (Vector. (q/width) (q/height)) 0.5)
                  :radius 50}]})

  )

(defn update-boid [b bs os]
  ;(.profile js/console "update")
  (let [requested []
        nearby-boids (filter (partial not= b) (filter #(< (dist (:position b) (:position %)) 100) bs))

        ;; Avoid walls

        requested (conj requested (multiply (Vector. -1 0) (/ 100 (q/sq (- (q/width) (:x (:position b)))))))
        requested (conj requested (multiply (Vector. 1 0) (/ 100 (q/sq (:x (:position b))))))
        requested (conj requested (multiply (Vector. 0 1) (/ 100 (q/sq (:y (:position b))))))
        requested (conj requested (multiply (Vector. 0 -1) (/ 100 (q/sq (- (q/height) (:y (:position b)))))))

        ;; Avoid obstacles


  (assoc state :obstacles [{:position (Vector. (:x e) (:y e))
                            :radius 50}]))

(defn mouse-clicked [state e]
  (assoc state :flock? (not (:flock? state))))

(defn boids-sketch []
  (q/sketch
    :host "boids-sketch"
