 (ns voke.world.visualize
   (:require [cljs.spec :as s]
+            [cljs.core.async :refer [chan <! put!]]
             [reagent.core :as r]
-            [voke.world.generation :as generate]))
+            [voke.world.generation :as generate])
+  (:require-macros [cljs.core.async.macros :refer [go]]))
 
 (s/def ::active-cell ::generate/cell)
 (s/def ::dungeon (s/keys :req [::generate/grid ::active-cell]))

           ^{:key ["row" y]} [row a-row y])

         (let [[x y] (@dungeon ::active-cell)]
           [:div.cell.active {:style {:left (* cell-size x)
                                      :top  (* cell-size y)}}]))])


(defn ^:export main []
  (r/render-component [grid dungeon]
                      (js/document.getElementById "content")))




; TODO construct some sort of system that takes a ::generation/world and draws its progress over time

(defn make-dungeon []

  (let [world (-> (generate/full-grid 30 30)
                  (generate/drunkards-walk 150))]
    {::generate/grid (world ::generate/grid)
     ::active-cell   [2 2]}))

(defonce dungeon (r/atom (make-dungeon)))

(defn row [a-row y]
  [:div.row
