 (defn- curr-second [state]
   (float (/ (:frame state) (:frame-rate state))))
 
-(defn- grid-size [state]
-  (let [h (int (* (window-size 1)
-                  (float (/ (:grid-width state) (window-size 0)))))]
-             [(:grid-width state) h]))
-
-(defn- scale [state xy]
+(defn- scale [grid-size xy]
   (map-indexed #(* %2 (float (/ (window-half-size %1)
-                                ((grid-size state) %1)))) xy))
+                                (grid-size %1)))) xy))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; poss-fn

(defn draw-state [state]
  ; Clear the sketch by filling it with light-grey color.
  (q/background 0xFFFFFFFF)
  (q/with-translation [(/ (window-size 0) 2)
                       (/ (window-size 1) 2)]

    (let [scale-fn #(scale state %)
          ghost (:ghost state)
          forest (:forest state)
          roots (forest/roots forest)

      adj-poss)))

(defn- mk-poss-fn [state]
  (let [grid-size (:grid-size state)]
    (fn [pos adj-poss]
      (->> adj-poss
           (filter #(in-bounds? grid-size %))
