|
|
@ -239,11 +239,9 @@
|
|
|
|
(<= 1 (length input) 2))
|
|
|
|
(<= 1 (length input) 2))
|
|
|
|
(let* ([verb (car input)]
|
|
|
|
(let* ([verb (car input)]
|
|
|
|
[response
|
|
|
|
[response
|
|
|
|
(cond
|
|
|
|
(case (length input)
|
|
|
|
[(= 2 (length input))
|
|
|
|
[(2) (handle-transitive-verb verb (cadr input))]
|
|
|
|
(handle-transitive-verb verb (cadr input))]
|
|
|
|
[(1) (handle-intransitive-verb verb)])]
|
|
|
|
[(= 1 (length input))
|
|
|
|
|
|
|
|
(handle-intransitive-verb verb)])]
|
|
|
|
|
|
|
|
[result (response)])
|
|
|
|
[result (response)])
|
|
|
|
(cond
|
|
|
|
(cond
|
|
|
|
[(place? result)
|
|
|
|
[(place? result)
|
|
|
@ -278,11 +276,10 @@
|
|
|
|
(and
|
|
|
|
(and
|
|
|
|
(verb-transitive? verb)
|
|
|
|
(verb-transitive? verb)
|
|
|
|
(cond
|
|
|
|
(cond
|
|
|
|
[(ormap (λ (thing)
|
|
|
|
[(for/first ([thing (in-list (append (place-things current-place)
|
|
|
|
(and (eq? (thing-name thing) obj)
|
|
|
|
player-inventory))]
|
|
|
|
thing))
|
|
|
|
#:when (eq? (thing-name thing) obj))
|
|
|
|
(append (place-things current-place)
|
|
|
|
thing)
|
|
|
|
player-inventory))
|
|
|
|
|
|
|
|
=> (λ (thing)
|
|
|
|
=> (λ (thing)
|
|
|
|
(or (find-verb verb-in (thing-actions thing))
|
|
|
|
(or (find-verb verb-in (thing-actions thing))
|
|
|
|
(λ ()
|
|
|
|
(λ ()
|
|
|
@ -296,7 +293,7 @@
|
|
|
|
;; Show what the player is carrying:
|
|
|
|
;; Show what the player is carrying:
|
|
|
|
(define (show-inventory)
|
|
|
|
(define (show-inventory)
|
|
|
|
(printf "You have")
|
|
|
|
(printf "You have")
|
|
|
|
(if (null? player-inventory)
|
|
|
|
(if (zero? (length player-inventory))
|
|
|
|
(printf " no items.")
|
|
|
|
(printf " no items.")
|
|
|
|
(for-each (λ (thing)
|
|
|
|
(for-each (λ (thing)
|
|
|
|
(printf "\n a ~a" (thing-name thing)))
|
|
|
|
(printf "\n a ~a" (thing-name thing)))
|
|
|
|