   (if (= 0 depth)
     (leaf-score ai turn)
     (min-max-step ai turn
-      (fn look-lower [transition]
+      (fn look-lower [_ transition]
         (tree-score ai
           (turn/apply-transition turn transition)
           (dec depth))))

  [board player]
  {:player player})

(defn- max-by
  [key-fn coll]
  (apply max-key key-fn coll))

(defn- maximizing-turn?
  [ai turn]
  (= (:player ai) (:player turn)))

(defn- min-max-step
  [ai turn on-transition]
  (apply
    (if (maximizing-turn? ai turn) max min)
    (map
      (fn [[_ transition]] (on-transition transition))
      (turn/player-transitions turn))))

;; -----------------------------------------

(defn- leaf-score
  [ai turn]
  (min-max-step ai turn
    (fn look-ahead [transition]
      (get
        (reduce scores/update-scores (:scores turn) transition)
        (:player ai)) ;; TODO - Blue score + min-max modification for AI Aliance
      )))

(defn tree-score

  (let [turn (game/current-turn game)
        ai (make-ai (:board turn) (:player turn))]
    (:game
      (min-max-step-by
        :score ai turn
        (fn [coord _]
          (let [new-game (game/play-move game coord)
                new-turn (game/current-turn new-game)]
            {:game new-game                             ;; TODO - Not sure keeping game in memory is wise
             :score (tree-score ai new-turn 1)})))
      )))


