Permalink
Browse files

Player can will now stay in the same place if asked to go somewhere i…

…llegal Robert & Holger
  • Loading branch information...
1 parent 4bd4cb9 commit ff052b45dafa15e020932edf228614e34807ef6d London Clojure Dojo committed Jan 26, 2010
Showing with 2 additions and 1 deletion.
  1. +2 −1 src/clork.clj
View
@@ -30,4 +30,5 @@
(defstruct player :location)
(defn move-player [a-player rooms direction]
- (struct player (move rooms (:location a-player) direction)))
+ (let [new-room (move rooms (:location a-player) direction)]
+ (if new-room (struct player new-room) a-player) ))

0 comments on commit ff052b4

Please sign in to comment.