Skip to content

Instantly share code, notes, and snippets.

@pelensky
Created August 11, 2017 10:14
Embed
What would you like to do?
App Runner namespace, with parts of the code I haven't changed removed.
(ns tic-tac-toe.app-runner
(:require clj-http.client :as client]))
; Code removed
(defn- api-call [board-state]
(let [result (client/post "https://xast1bug7h.execute-api.us-east-1.amazonaws.com/ttt" {:form-params {"boardState" (str board-state)} :content-type :json} )]
(read-string (get result :body))))
(defn- player-move [board-state player]
(case player
:human (human/choose-space)
:random-computer (random-computer/choose-space board-state)
:unbeatable-computer (api-call board-state)))
; Code removed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment