     (board/update-cells board updates)))
 
 
-;; -----------------------------------------
-;; Public API
-;; -----------------------------------------
-
-;; TODO - Refactor to get two things out
-;; 1. A new board
-;; 2. A list of the converted cells
-;; All grouped by point and by player
-
-
-#_(s/fdef all-available-moves
-    :args (s/tuple ::board/board)
-    :ret ::available-moves)
-
-#_(s/fdef apply-conversion
-    :args (s/tuple ::board/board ::conversion)
-    :ret ::board/board)
-
-
-(defn all-available-moves
-  "Return all move available on the board, grouped by player and by move"
-  [board]
-  (dissoc
-    (transduce
-      (mapcat #(available-conversions-at board %))
-      #(update-in %1 [(:winner %2) (:point %2)] conj %2)    ;; TODO - List of conversions
-      {}
-      (board/empty-cells board))
-    nil))                                                   ;; TODO - find why we have nil
-
-
-(defn apply-conversions
+(defn- apply-conversions
   [board moves]
   (if-let [move (first moves)]
     (reduce

      (conj moves (empty-cell-conversion (:winner move) (:point move)))
      )))


;; (require '[clojure.test.check.generators :as gen])
;; (def b (first (gen/sample (s/gen ::board/board) 1)))

(defn group-by-in
  "Group a collection of elements based on some keys to extract"
  [xf keys coll]
  (dissoc (transduce
            xf
            #(update-in %1 ((apply juxt keys) %2) conj %2)
            {}
            coll)
    nil))

(defn map-values
  "Apply a function to the values of a key-value collection"

         :board (delay (apply-conversions board moves))}
        ))

    (transduce
      (mapcat #(available-conversions-at board %))
      (group-by-reducer [:winner :point])
      (board/empty-cells board))
    ))

