        (dom/td nil))))))
 
 
-(defn cell-view [data owner]
+(defn player [data owner]
+  (do (println data))
+  (if data
+    (om/component (dom/td #js {:onClick #(om/set-state! owner :selected-unit data) }
+                          (dom/img #js {:src player-image })))
+    (om/component (dom/td #js {:onClick #(println data) }
+                          ))))
+
+(defn ball [data owner]
   (om/component (dom/td nil
                         (if data
-                          (dom/img #js {:src (str "images/" (:image data))})))))
+                          (dom/img #js {:src ball-image})))))
 
 (defn find-cell [x y data]
   (first


(defonce app-state (atom
                    {:cells
                      [{:x 0, :y 0, :team \a, :image "back-noball.gif"}
                       {:x 2, :y 0, :team \a, :image "back-noball.gif"}
                       {:x 4, :y 0, :team \a, :image "back-noball.gif"}
                       {:x 6, :y 0, :team \a, :image "back-noball.gif"}
                       {:x 8, :y 0, :team \a, :image "back-noball.gif"}
                       {:x 0, :y 8, :team \b, :image "back-noball.gif"}
                       {:x 2, :y 8, :team \b, :image "back-noball.gif"}
                       {:x 4, :y 8, :team \b, :image "back-noball.gif"}
                       {:x 6, :y 8, :team \b, :image "back-noball.gif"}
                       {:x 8, :y 8, :team \b, :image "back-noball.gif"}
                       {:x 0, :y 4, :ball true, :image "ball.gif"}
                       {:x 2, :y 4, :ball true, :image "ball.gif"}
                       {:x 4, :y 4, :ball true, :image "ball.gif"}
                       {:x 6, :y 4, :ball true, :image "ball.gif"}
                       {:x 8, :y 4, :ball true, :image "ball.gif"}]}))

(def board-width 9)
(def board-height 9)
(def bench-size 4)

(defn bench []
  (dom/table nil

        #js {:className
          (cond
            (or (= y 3) (= y 6)) "middle-top")}
              (vec (for [x (range 0 board-width)]
                (if (= y 4)
                  (om/build ball
                    (find-cell x y (concat [:x x] [:y y] (:loose-balls (:cells data)))))
                  (om/build player
                    (concat (:team-a (:cells data)) (:team-b (:cells data)))))))))))
  (bench)))


(om/root
