;;; Data for adventure game. This file is adv-world.scm ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; setting up the world ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (define Soda (instantiate place 'Soda)) (define DYC-Office (instantiate place 'DYC-Office)) (define MJC-Office (instantiate place 'MJC-Office)) (define 61A-Lab (instantiate place '61A-Lab)) (define art-gallery (instantiate place 'art-gallery)) (define Lewis (instantiate place 'Lewis)) (define Sproul-Plaza (instantiate place 'Sproul-Plaza)) (define Telegraph-Ave (instantiate place 'Telegraph-Ave)) (define Noahs (instantiate restaurant 'Noahs bagel 1.0)) (define Coffee-shop (instantiate restaurant 'coffee-shop coffee 1.5)) (define Intermezzo (instantiate place 'Intermezzo)) (define s-h (instantiate place 'sproul-hall)) (define heaven (instantiate locked-place 'heaven)) (define jail (instantiate place 'jail)) (can-go Soda 'up art-gallery) (can-go art-gallery 'down Soda) (can-go art-gallery 'west DYC-Office) (can-go DYC-Office 'east art-gallery) (can-go art-gallery 'east MJC-Office) (can-go MJC-office 'west art-gallery) (can-go Soda 'down 61A-Lab) (can-go 61A-Lab 'up Soda) (can-go Soda 'south Lewis) (can-go Lewis 'north Soda) (can-go Lewis 'south Sproul-Plaza) (can-go Sproul-Plaza 'north Lewis) (can-go Sproul-Plaza 'south Telegraph-Ave) (can-go Sproul-Plaza 'east s-h) (can-go s-h 'west Sproul-Plaza) (can-go Telegraph-Ave 'north Sproul-Plaza) (can-go Telegraph-Ave 'south Noahs) (can-go Noahs 'north Telegraph-Ave) (can-go Noahs 'south Intermezzo) (can-go Noahs 'up coffee-shop) (can-go coffee-shop 'down noahs) (can-go Intermezzo 'north Noahs) (can-go soda 'death heaven) (can-go heaven 'rebirth soda) (define (sproul-hall-exit count) (lambda () (if (< count 3) (begin (set! count (+ 1 count)) (error "You can check out any time you'd like, but you can never leave")) (display "You may leave now")))) (define exit-1 (sproul-hall-exit 0)) (define (dyc-office-exit) (print "Who's your favorite instructor?") (let ((answer (read))) (cond ((or (eq? answer 'DYC) (eq? answer 'David)) (print "Thanks!")) ((or (eq? answer 'Bryan) (eq? answer 'Lai) (eq? answer 'Erik) (eq? answer 'Todd) (eq? answer 'Jeremy) (eq? answer 'Will)) (print "I'll let them know!")) ((eq? answer 'Brenda) (print "I'm quite fond of her too...")) (else (begin (newline) (dyc-office-exit)))))) (ask s-h 'add-entry-procedure (lambda () (print "Miles and miles of students are waiting in line..."))) (ask s-h 'add-exit-procedure exit-1) (ask DYC-Office 'add-exit-procedure dyc-office-exit) (ask Noahs 'add-entry-procedure (lambda () (print "Would you like lox with it?"))) (ask Noahs 'add-exit-procedure (lambda () (print "How about a cinnamon raisin bagel for dessert?"))) (ask Telegraph-Ave 'add-entry-procedure (lambda () (print "There are tie-dyed shirts as far as you can see..."))) (ask 61A-Lab 'add-entry-procedure (lambda () (print "The computers seem to be down"))) (ask 61A-Lab 'add-exit-procedure (lambda () (print "The workstations come back to life just in time."))) ;; Some things. ;(define bagel (instantiate thing 'bagel)) ;(ask Noahs 'appear bagel) ;(define coffee (instantiate thing 'coffee)) ;(ask Intermezzo 'appear coffee) (define b1 (instantiate bagel)) (ask soda 'appear b1) (define c1 (instantiate coffee)) (ask soda 'appear c1) (define b2 (instantiate bagel)) (ask soda 'appear b2) (define rock (instantiate thing 'rock)) (ask soda 'appear rock) ;; Some people. (define David (instantiate person 'David DYC-Office)) (define Brenda (instantiate person 'Brenda DYC-Office)) (define hacker (instantiate person 'hacker 61A-lab)) (define nasty (instantiate thief 'nasty sproul-plaza)) (define simon (instantiate person 'simon noahs)) (define cop (instantiate police 'cop lewis))