     (if-let [error (error-message new-score points)]
       (reset! message error)
       (record-score @current-player @score))))
+
+(defn average [player-id]
+  (let [rounds (:rounds (get @game player-id))]
+    (if (> (count rounds)
+           0)
+      (-> (reduce + rounds)
+          (/ (count rounds))
+          (* 100)
+          Math/round
+          (/ 100))
+      0)))
+
+(defn print-rounds [player-id]
+  (str (:rounds (get @game player-id))))
 
 (defn numpad []
   [:div

                         (clear-message))} "Clear"]
   [:button {:on-click submit-score} "Enter"]])




(defn play-page []
  [:div
   @message
   [:div
    [:span "Player 1: " (points 0)]
    [:br]
    [:span "Player 2: " (points 1)]]
   [:div
    [:br]
    (str "Player " (+ 1 @current-player) " turn")

    [numpad]
    (println @game)]])

(defn select-game-pane []
  [:div
   [:div "Starting score: "
    [:select {:id "score"
              :on-change #(reset! game-score
                                  (.-value (js/document.getElementById "score")))}
     (map (fn [score]
            ^{:key score}
            [:option score])
          [310 410 510])]]])

(defn new-game-page []
  (load-players)
