     (println (apply str row))))
 
 
-(defn get-board [board]
-  (let [rows (partition 3 board)]
-    (hiccup/html [:center
-                  [:table {:border "1px solid black"}
-                  (for [row rows]
-                    [:tr (for [cell row]
-                       [:td (element/image (cell picture-map))])])]
-                 (form/form-to [:post "/post"] (form/submit-button "asdf" ))])))
 
 
 (defn zip [rest]

            [hiccup.core :as hiccup]
            [hiccup.form :as form]
            [hiccup.element :as element]
))

(def picture-map {:e "empty.png" :x "cross.png" :o "nought.png"})




;;
;; Web stuff below this point!
;;

(defn get-board [board]
  (let [rows (partition 3 board)]
    (hiccup/html [:center
                  [:table {:border "1px solid black"}
                   (for [[row-number row] (map-indexed vector rows)]
                     [:tr
                      (for [[column-number cell] (map-indexed vector row)]
                       [:td 
                        [:a {:href (str "/place-piece/" (+  column-number (* row-number 3)) )}
                         (element/image (cell picture-map))]])])]
                 (form/form-to [:post "/post"] (form/submit-button "asdf" ))])))

(defn get-board-atom []
  (get-board @board))


(defroutes app-routes
  (GET "/" [] (get-board-atom))
  (GET "/place-piece/:pos" [pos] (do
                                   (swap! board place-piece :x (Integer/parseInt pos))
                                   (resp/redirect "/")))
  (POST "/post" [] (get-board board-draw ))
  (route/resources "/")
  (route/not-found "<h1>Page not found</h1>"))
