 ;    ["UCLA"
 ;     "Tulsa"]]]
 ;  )
-;
+
 (def bracket
   [["VCU"
     "Stephen F. Austin"]

    (partial compute-matchup pick-scoring upset-scoring)
    tournament-bracket))

(defn update-future-pts [[field children] parent-team-map]
  "Update the future-pts of each team in the field using parent-team-map.  The future-pts for each team in the
  field is the team's average points plus the future-pts of the team in the parent-team-map."
  (vector

      field)
    children))

(defn update-future-pts [[field children]]
  "For each child in children, update the future-pts of the teams in that child's field.  The future-pts for each team
  in a field is the team's average points plus the future-pts of the team in the parent field."
  (vector
    field
    (let [parent-team-map (->>                                                ;create parent map
                            field
                            (map #((juxt :name identity) %))
                            (into {}))]
      (map
        (partial update-child-future-pts parent-team-map)
        children))))

(defn- compute-future-pts-helper [loc]
  (if (zip/end? loc)
    loc
    (recur (->>
             (zip/edit loc update-future-pts)
             zip/next))))

(defn compute-future-pts [tp]
  (->>
    (update-child-future-pts nil tp)
    (zip/zipper
      (fn [[_ cn]]
        (or (vector? cn) (seq? cn)))
      (fn [[_ cn]]
        (seq cn))
      (fn [node cn]
        (assoc node 1 cn)))
    compute-future-pts-helper
    zip/root))

;(def bracket
