Skip to content

Instantly share code, notes, and snippets.

@siscia
Created July 26, 2014 19:07
Show Gist options
  • Save siscia/4653d6a272a8453b313b to your computer and use it in GitHub Desktop.
Save siscia/4653d6a272a8453b313b to your computer and use it in GitHub Desktop.
(defn update-world [world room action]
;; if action is something like pick up an object from the room
;; I will return a new world without such object in the room,
;; if, otherwise, you are moving between some room I will return the same
;; world but you will obviously change the room
)
(loop [world {:roomA {} :roomB {}
room :roomA]
(let [[new-world next-room] (update-world world room (get-input))
(recur new-world next-room)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment