 
 (defn home-page []
   [:div
+   [:div
+    [:input {:type "button" :value "back"}]
+    [:input {:type "button" :value "next"
+             :on-click #(let [move (js->clj (get (.history loaded-game #js {:verbose true}) current-ply))]
+                          (println "From: " (move "from") " to:" (move "to"))
+                          (.move chessground (move "from") (move "to"))
+                          (set! current-ply (inc current-ply)))}]]
    [shared-state]
    [reset-button]])
 

  (.getElementById js/document (name id)))

(def chess (js/Chess.))
(def chessground (js/Chessground. (by-id "chessground-container")))

(def SQUARES (.-SQUARES chess))


(defn load-pgn [pgn]
  (println "load-pgn: " pgn)
  (set! current-ply 0)
  (.reset chess)
  (.reset loaded-game)
  (.load_pgn loaded-game pgn)
  (println "FEN: " (.fen loaded-game))
  (.set chessground #js {
                         :viewOnly true
                         :autoCastle true
                         :turnColor "white"
                         :fen "start"
                         :animation #js { :duration 500 }
                         :drawable #js { :enabled true }
                         }))
