;;; cave0.ss ;;; A small sample cave. ;;; It calls the functions create-cave and connect-caves ;;; and (at the end) create-player. ;(load "hw08soln.ss") ;; First just define a bunch of individual caves: (define matthias (create-cave 'matthias-office 'a-little-schemer)) (define ian (create-cave 'ian-office 'clutter)) (define greiner (create-cave 'johnGreiners-den 'colnago-racing-bike)) (define clements (create-cave 'johnClements-lair 'mystic-runes)) (define cork (create-cave 'corkys-office 'a-corkboard)) (define eastHall (create-cave 'east-hallway 'a-strange-smell)) (define westHall (create-cave 'west-hallway null)) (define southHall (create-cave 'overlook null)) (define dh3110 (create-cave 'meeting-room 'pizza-crumbs)) (define martelHall (create-cave 'lobby 'fancy-roof-design)) (define stairs (create-cave 'stairs 'muddy-footprints)) (define elevator (create-cave 'elevator 'many-buttons)) (define classroom (create-cave 'lecture-hall 'soporific)) ;; Now, make some connections: ;; (connect-caves eastHall 'a-bright-light southHall) (connect-caves westHall 'a-bright-light southHall) (connect-caves southHall 'a-northeast-exit eastHall) (connect-caves southHall 'a-northwest-exit eastHall) (connect-caves southHall 'door3110 dh3110) (connect-caves elevator 'a-button-marked-3 southHall) (connect-caves elevator 'a-button-marked-1 martelHall) (connect-caves southHall 'a-precipitous-drop martelHall) (connect-caves martelHall 'some-shiny-doors elevator) (connect-caves martelHall 'door1064 classroom) (connect-caves classroom 'door1064 martelHall) (connect-caves martelHall 'sunshine null) ;(connect-caves martelHall 'sunshine outside) ; ; "outside" this is a special cave ; ; defined in hw08soln.ss. ; ; That cave must be used to recognize the end. ;; You assignment doesn't require you to write a function biconnect-caves, ;; but wouldn't that be easier, to create two-way connections? ;; (biconnect-caves eastHall 'door3105 matthias) (biconnect-caves eastHall 'door3102 ian) (biconnect-caves eastHall 'door3104 cork) (biconnect-caves westHall 'door3111 clements) (biconnect-caves westHall 'door3118 greiner) ;; Some tests ;; Well, at least if you write a function cave-exit-names, ;; then it is easy to just look up the names of connected rooms. ;; What happens if you just print out (cave-exits matthias)? (cave-exit-names matthias) (cave-exit-names elevator) (define playerI (create-player eastHall)) (spelunk playerI)