        (round-info 7)
        (tournament-probabilities
          pick-scoring
-         upset-scoring)))+         upset-scoring)
+       compute-expected-value))
(defn- update-child-expected-value
  "Update the expected value of each team in the field using parent-team-map.  The expected value for each team in the
  field is the team's average points plus the expected value of the team in the parent-team-map."
  [parent-team-map [field children]]
  (vector
    (map
      #(update-in % [:expected-value] (fnil + 0 0)
                  (get-in parent-team-map [(:name %) :expected-value])
                  (:avg-pts %))
      field)
    children))

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

(defn- compute-expected-value-helper
  "Recursively traverse the zipper, updating each node with the expected value computation."

    loc
    (recur (zip/next (zip/edit loc update-expected-value)))))

(defn- branch? [node]
  (and (map? node) (contains? node :upper) (contains? node :lower)))

(defn children [node]
  ((juxt :upper :lower) node))

(defn make-node [existing [upper lower]]
  (-> (assoc-in existing [:upper] upper)
      (assoc-in [:lower] lower)))

(defn compute-expected-value
  "Compute the expected value for each node in the tournament probabilites tree."
  [tp]
  (->> (update-child-expected-value nil tp)
       (zip/zipper
         branch?
         children
         make-node)
       compute-expected-value-helper
       zip/root))

(defn predict-bracket
  "Predict the expected value for each team in each round of the tournament.  Bracket should be
