 
 (declare propogated-coordinates)
 
-(def ^:private bomb? (partial = :bomb))
-
-(defn random-tuples [x y]
-  (repeatedly #(vector (rand-int x) (rand-int y))))
-
-(defn add-bombs [board c]
-  (let [w (count board)
-        h (count (first board))
-        coords (take c (distinct (random-tuples w h)))]
-    (reduce (fn [b coord]
-              (assoc-in b coord :bomb)) board coords)))
-
 (defn neighbors [board i j]
   (remove nil?
           (for [x [-1 0 1]


(defn neighbor-bombs [board i j]
  (->> (neighbors board i j)
       (filter bomb?)
       count))

(defn annotate [board]
  (mapv (fn [row r]
          (mapv (fn [space c]
                  (let [b? (bomb? space)]
                    {:bomb? b?
                     :revealed? false
                     :count (when-not b? (neighbor-bombs board r c))
                     :path [r c]}))
                row (range))) board (range)))

(defn generate-board
  ([]

   (let [settings (levels level)]
     (apply generate-board settings)))
  ([w h bombs]
   (-> (generate-base w h)
       (add-bombs bombs)
       annotate)))

(defn spaces [board]
  (into [] cat board))

(defn won? [board]
  (let [s (spaces board)]
