Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Step 4: use a var for current-room.

  • Loading branch information...
commit 47ee094c5325a39bdab0c0e13048f864166e588a 1 parent 5a206a4
@technomancy authored
Showing with 4 additions and 6 deletions.
  1. +2 −1  src/mire.clj
  2. +1 −1  src/mire/commands.clj
  3. +1 −4 src/mire/rooms.clj
View
3  src/mire.clj
@@ -9,7 +9,8 @@
(defn- mire-handle-client [in out]
(binding [*in* (reader in)
- *out* (writer out)]
+ *out* (writer out)
+ *current-room* (rooms :start)]
(println (look))
(print prompt) (flush)
(loop [input (read-line)]
View
2  src/mire/commands.clj
@@ -16,7 +16,7 @@
(let [target-name ((:exits *current-room*) (keyword direction))
target (rooms target-name)]
(if target
- (do (set-current-room target)
+ (do (set! *current-room* target)
(look))
"You can't go that way.")))
View
5 src/mire/rooms.clj
@@ -7,7 +7,4 @@
:closet {:desc "You are in a cramped closet."
:exits {:south :start}}})
-(def *current-room* (rooms :start))
-
-(defn set-current-room [target]
- (def *current-room* target))
+(def *current-room*)
Please sign in to comment.
Something went wrong with that request. Please try again.