 (defn free-spots [board]
   (for  [i (range board-size)
          j (range board-size)
-        :when (= (get-in board [i j]) "B")]
-        [i j]))
+         :when (= (get-in board [i j]) "B")]
+    [i j]))
 
 (defn draw? [board]
   (empty? (free-spots board)))


(defn threat-by? [from to line]
  (and (= 0 (count (filter #(= % to) line))) 
   (= (dec winning-k) (count (filter #(= % from) line)))))

(defn threat-lines [from to board]
  (filter #(threat-by? from to (get-coords board %)) (all-lines-coords)))


(defn all-lines-coords []
  (concat  [(diagonal-down-coords) (diagonal-up-coords)]
           (for [i (range board-size)] (horizontal-coords i))
           (for [i (range board-size)] (vertical-coords i))))

(defn get-coords [board coords]
  (map #(get-in board %) coords))

(defn all-lines [board]
  (map #(get-coords board %)  (all-lines-coords)))

(defn winning-by? [player line]
  (every? #(= % player) (take winning-k line)))
