Skip to content

Instantly share code, notes, and snippets.

@tarynsauer
Created March 3, 2014 00:50
Show Gist options
  • Select an option

  • Save tarynsauer/9316549 to your computer and use it in GitHub Desktop.

Select an option

Save tarynsauer/9316549 to your computer and use it in GitHub Desktop.
(defn next-move [board player-x player-o]
(player-move-message (current-piece board))
(print-board board)
(let [move (get-move (current-player board player-x player-o) board)]
(if (valid-move? board move)
(apply-move board move)
(recur board player-x player-o))))
(defn play [board player-x player-o]
(loop [board board player-x player-x player-o player-o]
(if (game-over? board)
(game-over-message board (opponent board))
(recur (next-move board player-x player-o) player-x player-o))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment