     {:game-events player-moves
      :menu-events menu-events}))
 
+
+;; -----------------------------------------
+;; Public API
+;; -----------------------------------------
+
 (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))

      (<! (async/timeout ai-move-delay))
      (<! ai-chan))))

(defn handle-menu-event!
  "Handle the menu event"
  [msg]
  (case msg

(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)"
