           transitions (turn/player-transitions turn)
           next-games (map #(game/play-move game (first %)) transitions)
           min-max (if (= (:player ai) (:player turn)) max min)]
-      (apply min-max (map #(tree-score ai % (dec depth)) next-games)))
+      (apply min-max
+        (map #(tree-score ai % (dec depth)) next-games)))
     ))
 
 (defn test-score-tree

;; TODO - How to add the custom scoring? How to keep the game? (use keys)
;; TODO - Use mapmin from http://worrydream.com/refs/Hughes-WhyFunctionalProgrammingMatters.pdf
;; TODO - Sort by scores as well
(defn leaf-score
  [ai game]
  (:scores (game/current-turn game)))

#_(defn map-min
  [scoring])

(defn tree-score
  [ai game depth]

  :ret ::game/game)

(defn- play-best-move
  [game]
  (let [turn (game/current-turn game)
        ai (make-ai (:board turn) (:player turn))]
    (:game
      (max-by :scoring
        (map
          (fn [[coord _]]
            (let [new-game (game/play-move game coord)]
              {:game new-game
               :scoring (tree-score ai new-game 1)}))
          (turn/player-transitions turn)))
      )))

#_(defn- play-best-move
  "[SIMPLISTIC] Play the best move for a player based on:
   * The immediate gain
   * The worse immediate lost afterwards"
