                     (partial produce-distances-async maze-params :dist2 :blue)
                     (partial produce-path-async maze-params true)]))
 
-(defn produce-maze-async [{:keys [rows columns algorithm] :as maze-params}]
+(defn produce-maze-async [{:keys [rows columns algorithm anim-chan] :as maze-params}]
   (println (str "algorithm: " algorithm))
   (set-maze-params! :active "Carving maze …")
   (let [grid (grid/make-grid rows columns)

        result-chan (algs/seq-channel algorithm-fn)]
    (go
      (set-maze-params! :grid (atom grid))
      (async/<! (async/timeout 0))
      (loop [prev-maze nil]
        (if-let [new-maze (async/<! result-chan)]
          (do
            (set-maze-params! :grid (atom new-maze))
            (async/<! (async/timeout 0))
            (recur new-maze))
          (do
            (set-maze-params! :active nil)

  [_ form-value _]
  form-value)

(defmethod produce-maze-value :anim-chan
  [_ form-value _]
  form-value)

(defmethod produce-maze-value :grid
  [_ new-value {:keys [maze] :as state}]
  (let [{:keys [algorithm rows columns grid]} maze]
