Skip to content

Instantly share code, notes, and snippets.

@pelensky
Created August 11, 2017 10:14
Show Gist options
  • Save pelensky/340f546e43ef991dff01a1ab6cde9b37 to your computer and use it in GitHub Desktop.
Save pelensky/340f546e43ef991dff01a1ab6cde9b37 to your computer and use it in GitHub Desktop.
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