Sha256: 61a4434973efc71e55d26cc4792bb0df626d6590b7b78a59c515c2e1394b94fc

Contents?: true

Size: 1.79 KB

Versions: 17

Compression:

Stored size: 1.79 KB

Contents

(setf *objects* '(whiskey-bottle bucket frog chain))

(setf *map* '((living-room (you are in the living-room of a wizards house. there is a wizard snoring loudly on the couch.)
                           (west door garden)  
                           (upstairs stairway attic))
              (garden (you are in a beautiful garden. there is a well in front of you.)
                      (east door living-room))
              (attic (you are in the attic of the wizards house. there is a giant welding torch in the corner.)
                     (downstairs stairway living-room))))

(setf *object-locations* '((whiskey-bottle living-room)
                           (bucket living-room)
                           (chain garden)
                           (frog garden)))

(setf *location* 'living-room)

(defun describe-location (location map)
  (second (assoc location map)))

(defun describe-path (path)
  `(there is a ,(second path) going ,(first path) from here.))

(defun describe-paths (location map)
  (apply #'append (mapcar #'describe-path (cddr (assoc location map)))))

(defun is-at (obj loc obj-loc)
  (eq (second (assoc obj obj-loc)) loc))

(defun describe-floor (loc objs obj-loc)
  (apply #'append (mapcar (lambda (x)
                            `(you see a ,x on the floor.))
                          (remove-if-not (lambda (x)
                                           (is-at x loc obj-loc))
                                         objs))))

(defun look ()
  (append (describe-location *location* *map*)
          (describe-paths *location* *map*)
          (describe-floor *location* *objects* *object-locations*)))

(defun walk-direction (direction)
  (let ((next (assoc direction (cddr (assoc *location* *map*)))))
    (cond (next (setf *location* (third next)) (look))
    (t '(you cant go that way.)))))


Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
facets-1.0.3 packages/more/demo/lisp/game.rb
facets-1.4.0 demo/lisp/game.rb
facets-1.4.2 demo/lisp/game.rb
facets-1.4.1 demo/lisp/game.rb
facets-1.4.3 demo/lisp/game.rb
facets-1.4.4 demo/lisp/game.rb
facets-1.4.5 demo/lisp/game.rb
facets-1.7.30 demo/lisp/game.rb
facets-1.7.0 demo/lisp/game.rb
facets-1.7.38 demo/lisp/game.rb
facets-1.7.46 demo/lisp/game.rb
facets-1.8.49 demo/lisp/game.rb
facets-1.8.0 demo/lisp/game.rb
facets-1.8.20 demo/lisp/game.rb
facets-1.8.51 demo/lisp/game.rb
facets-1.8.8 demo/lisp/game.rb
facets-1.8.54 demo/lisp/game.rb