     :restart (store/swap-game! game/restart-game)
     :undo (store/swap-game! game/undo-player-move)))
 
-(defn start-game-loop
+(defn- start-game-loop
   "Manage transitions between player moves, ai moves, and generic game events"
   []
   (let [player-moves (chan 1 (filter #(not @store/ai-player?)))

    {:game-events player-moves
     :menu-events menu-events}))

(defonce game-loop (start-game-loop))

(defn send-game-event! [e] (put! (game-loop :game-events) e))
(defn sent-menu-event! [e] (put! (game-loop :menu-events) e))

(ns triboard.game-loop
  (:require-macros
    [cljs.core.async.macros :refer [go go-loop alt!]])
  (:require
    [cljs.core.async :as async :refer [put! chan <! >!]]
    [triboard.ai.ai :as ai]
    [triboard.logic.game :as game]
    [triboard.store :as store]))


(def animation-delay 500)
(def ai-move-delay 1000)

(defn- ai-computation
  "Run the computation of the AI asynchronously:
   * Wait 500ms to start (animation might be frozen otherwise)
   * Wait 1s to play the move (avoid moves being played too fast)"
