Skip to content

Instantly share code, notes, and snippets.

@zspencer
Created April 19, 2014 01:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zspencer/4d378e1d1d833041ccd5 to your computer and use it in GitHub Desktop.
Save zspencer/4d378e1d1d833041ccd5 to your computer and use it in GitHub Desktop.
(defn walk-fn [game]
(assoc game :player (move-player (:player game))))
(def actions-map { :walk walk-fn })
;; ai is a function which returns an action keyword based upon the game state
(defn play-round [game ai]
(-> (get (ai game) actions-map)
(apply [game])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment