   [game]
   (-> game :current-node :board))
 
+(defn current-node-id
+  "Returns the node id of the current node."
+  [game]
+  (-> game :current-node :node-id))
+
 (defn find-node-matching
   "Finds the first (as found by a depth-first search) game tree node
   matching the given predicate. If no such node is found, returns nil."

  have to unzip and zip the tree for each added move. If
  remove-existing-moves? is true, any previously existing moves at the point
  of insertion are removed."
  [game uci-moves & {:keys [node-id remove-existing-moves?]}]
  (add-move-sequence game board/move-from-uci uci-moves
                     (or node-id (-> game :current-node :node-id))
                     remove-existing-moves?))


(defn add-key-value-pair
  "Adds a key value pair to the map at the given node id of the game. If no
  node id is supplied, the key value pair is added at the current node."
  [game key value & {:keys [node-id]}]
  (let [z (-> (game-zip game (or node-id (-> game :current-node :node-id)))
              (zip-add-key-value-pair key value))
        g (assoc game :root-node (zip/root z))]
    (assoc g :current-node (find-node g (-> g :current-node :node-id)))))


(defn add-comment

  game at a given node id. The move is added as the last child. If no node id
  is supplied, the current node of the game is used. If remove-existing-moves?
  is true, any previously existing moves at the point of insertion are removed."
  [game map-move & {:keys [node-id remove-existing-moves?]
                    :or {node-id (current-node-id game)}}]
  (add-move game board/move-from-map map-move
            node-id
            remove-existing-moves?))


