Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
(defn- start-game-loop
"Manage transitions between player moves, ai moves, and generic game events"
(let [play-events (chan 1 (filter #(not @store/ai-player?)))
game-events (chan 1)]
(while true
(let [play-chan (if @store/ai-player?
(ai-computation @store/game)
game-events ([msg] (handle-menu-event! msg))
play-chan ([coord] (store/swap-game! game/play-at coord))
{:play-events play-events
:game-events game-events}))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment