         (alt!
           player-events ([coord] (update-game! play-move coord))
           game-events ([msg] (when (= msg :new-game) (new-game!)))
-          ai-events ([msg] (when (= msg :ai-play) (handle-ai)))
+          ai-events ([msg] (when (= msg :ai-play) (handle-ai!)))
           (async/timeout ai-move-delay) ([_] (put! ai-events :ai-play))
           )))
     

(defn is-ai? [player]
  (contains? @ai-players player))


;; -----------------------------------------
;; GAME LOOP
;; -----------------------------------------

(defn- handle-ai []
  (let [ai-algo (get @ai-players @current-player)
        move (ai-algo @game @current-player)]
    (update-game! play-move move)))

  [:div.scores
   [top-panel-button #(put! (:game-events game-loop) :new-game) (special-char "&#x21bb;")]
   (show-scores scores player)
   [top-panel-button #(swap! app-state update :help not) "?"]
   [top-panel-button cancel-last-move! (special-char "&#x2190;")]])

(defn max-board-height []
  (- (-> (dom/getWindow) dom/getViewportSize .-height) 100))
