   (cond
    (and
     (= nil (selected-unit))
-    (unit? x y (:turn @game)))
+    (boolean (unit? x y (:turn @game))))
    {:type   :select-unit
     :id     (:id (unit? x y (:turn @game)))
     :coords {:x x :y y}}
 
    (or
-     (unit? x y (:turn @game))
+     (boolean (unit? x y (:turn @game)))
      (not (in-range? x y (:id (selected-unit)))))
    {:type   :deselect-unit
     :id     (:id (unit? x y (:turn @game)))

    (swap! game assoc-in [:units (:turn @game)] (conj team updated-unit))))

(defn move-unit [x y]
    (let [selected-unit (selected-unit)
        updated-unit
        (conj
         selected-unit
         {:coords {:x x :y y}})
        team
        (filter #(not= selected-unit %) (active-team))]
      (swap! game assoc-in [:units (:turn @game)] (conj team updated-unit))))

(defn ball-in-front-of-unit? [ball unit]
  (let [ball-x (:x (:coords ball))

   (.getElementById js/document "app"))
  (go
   (loop []
     (let [event (<! ch)
           x (:x (:coords event))
           y (:y (:coords event))]
       (println event)
        (case (:type event)
          :select-unit   (select-unit (:id event))
          :deselect-unit (deselect-unit)
          :move-unit     (do
                           (move-unit x y)
                           (swap! game update-in [:actions] inc)
                           (deselect-unit)
                           (if (= (:actions @game) 2) (switch-turns)))
          :pickup-ball   (do
                           (pickup-ball x y)
                           (swap! game update-in [:actions] inc)
                           (deselect-unit)
                           (if (= (:actions @game) 2) (switch-turns)))
          :attack        (do
                           (attack x y)
                           (swap! game update-in [:actions] inc)
                           (deselect-unit)
                           (if (= (:actions @game) 2) (switch-turns))))
