                      x (to-scale (+ 445 (* 10 player-index)))]
                  (for [pirate-index (range pirate-count)]
                    (let [y (to-scale (+ 245 (* 10 pirate-index)))]
-                     [:circle {:cx x :cy y :r (to-scale 4) :fill color-name}]))))))))
+                     [:circle
+                      {:cx x
+                       :cy y
+                       :r (to-scale 4)
+                       :fill color-name
+                       :on-click (fn ship-click [e]
+                                   (pirate-click @app-state pirate-color 37))}]))))))))
 
 (defn normal-space [x y]
-  [:rect {:x (to-scale x) :y (to-scale y) :width (to-scale 40) :height (to-scale 30) :stroke "black" :stroke-width "0.5" :fill "lightgray"}])
+  [:rect
+   {:x (to-scale x)
+    :y (to-scale y)
+    :width (to-scale 40)
+    :height (to-scale 30)
+    :stroke "black"
+    :stroke-width "0.5"
+    :fill "lightgray"}])
 
 (defn space-image [x y icon]
-  [:g {:dangerouslySetInnerHTML {:__html (str "<image xlink:href=\"" (icon icon-images) "\" x=\"" (to-scale x) "\" y=\"" (to-scale y) "\" width=\"" (to-scale 30) "\" height=\"" (to-scale 30) "\" />")}}]
-  )
+  [:g
+   {:dangerouslySetInnerHTML
+    {:__html (str "<image xlink:href=\"" (icon icon-images) "\" x=\"" (to-scale x) "\" y=\"" (to-scale y) "\" width=\"" (to-scale 30) "\" height=\"" (to-scale 30) "\" />")}}])
 
 (defn normal-spaces []
   (apply concat


(defn static-board []
  [;; board
   [:rect {:x 0 :y 0 :width (to-scale 500) :height (to-scale 300) :stroke "black" :stroke-width "0.5" :fill "burlywood"}]
   ;; jail
   [:rect {:x 0 :y 0 :width (to-scale 50) :height (to-scale 90) :stroke "black" :fill "darkgray"}]
   [:g {:dangerouslySetInnerHTML {:__html (str "<image xlink:href=\"img/jail.png\" x=0 y=0 width=\"" (to-scale 30) "\" height=\"" (to-scale 30) "\" />")}}]
   ;; ship
   [:rect {:x (to-scale 400) :y (to-scale 240) :width (to-scale 90) :height (to-scale 50) :stroke "black" :fill "sienna"}]
   [:g {:dangerouslySetInnerHTML {:__html (str "<image xlink:href=\"img/ship.png\" x=\"" (to-scale 400) "\" y=\"" (to-scale 240) "\" width=\"" (to-scale 30) "\" height=\"" (to-scale 30) "\" />")}}]
   ])

(def piece-positions

   {:x 400 :y 240}
 ])

(defn pirate-click [game-state color from-space-index]
  (println "clicked pirate:" color from-space-index))

(defn jail []
  (when-let [jail (get-in @app-state [:board 0])]
    (apply concat
