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

      (let [ai-turn? #(contains? (:ai-players %) (:player %))
            new-list (drop-while ai-turn? (drop 1 old-list))]
        (if (empty? new-list)
          old-list new-list)))
    ))



        is-human-xf (fn [_] (not (is-ai? @current-player)))
        is-ai-xf (fn [_] (is-ai? @current-player))
        ai-events (chan 1 (comp (filter game-on-xf) (filter is-ai-xf)))
        player-events (chan 1 (comp (filter game-on-xf) (filter is-human-xf)))]
    
    (go
      (while true
        (alt!
          player-events ([coord] (update-game! play-move coord))
          ai-events ([msg] (when (= msg :ai-play) (handle-ai!)))
          (async/timeout ai-move-delay) ([_] (put! ai-events :ai-play))
          )))
    
    player-events))

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

