         (let [tile (nth board (+ (* y dim) x))]
           (render-tile [x y] tile command)))]
      [:h4 (if (b/solved? board) "Solved!" "Slide tiles with arrow keys or clicking on tile")]
+     [:details [:summary (str (count moves) " moves.")] (str moves)]
      (board-size-slider size command)
      [:div
       [:label "Analysis Mode"]


(defonce app-state
  (r/atom {:board (b/create-board 4 :shuffle)
           :size 4
           :analysis-mode false}))

(defn new-board! [& args]
  (swap! app-state assoc :board (apply b/create-board (:size @app-state) args)))

(defn slide! [arg]
  (swap! app-state update-in [:board] b/slide arg))

(defn board-size-slider [size command]
  [:div

    [:tr [:td "S"] [:td "Solve next piece"]]]])

(defn tile-grid [command]
  (let [{:keys [board size analysis-mode moves]} @app-state
        dim (b/dimension board)]
    [:center
     [:h1 "Tile Puzzle"]
