 (defn player-has-won [player partitions]
   (some (fn [partition] (every? #(= player %) partition)) partitions))
 
-(defn winner
-  "Return one of :x, :o, nil, :draw"
+(defn get-game-state
+  "Return one of :x, :o, :ongoing, :draw"
   ([board]
      (let [partitions (winning-partitions board)]
        (cond
         (player-has-won :x partitions) :x
         (player-has-won :o partitions) :o
         (empty? (available-squares board)) :draw
-        :else nil))))
+        :else :ongoing))))
 
 ;(winner blank-board)
 


(defn get-board [board]
  (let [rows (partition 3 board)
        piece (toggle)]
    (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)) "/" (name piece) )}
                         (element/image (cell picture-map))]])])]
                 (form/form-to [:post "/post"] (form/submit-button "asdf" ))])))

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

       (do
         (swap! board place-piece (keyword piece) (Integer/parseInt pos))
         (resp/redirect "/")))
  (POST "/post" [] (do
                     (reset! board blank-board)
                     (resp/redirect "/")))
  (route/resources "/")
  (route/not-found "<h1>Page not found</h1>"))

