Permalink
Browse files

Step 4: use a var for current-room.

  • Loading branch information...
technomancy committed Feb 7, 2009
1 parent 5a206a4 commit 47ee094c5325a39bdab0c0e13048f864166e588a
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
@@ -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
@@ -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
@@ -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*)

0 comments on commit 47ee094

Please sign in to comment.