     :id     (:id (unit? x y :balls))
     :coords {:x x :y y}}
 
+   (boolean (unit? x y (defense)))
+   {:type :attack
+    :id (:id (unit? x y (:turn @game)))
+    :coords {:x x :y y}}
+
 
    (in-range? x y (:id (unit? x y (:turn @game))))
    {:type :move-unit
     :id (:id (unit? x y (:turn @game)))
     :coords {:x x :y y}}
+
+
 
    :else
      (println x y (:turn @game))))

  (cond
   (and
    (= nil (selected-unit))
    (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))
     (not (in-range? x y (:id (selected-unit)))))
   {:type   :deselect-unit
    :id     (:id (unit? x y (:turn @game)))

   (.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))))
