1 ;;; dunnet.el --- text adventure for Emacs -*- byte-compile-warnings: nil -*-
3 ;; Copyright (C) 1992-1993, 2001-2011 Free Software Foundation, Inc.
5 ;; Author: Ron Schnell <ronnie@driver-aces.com>
6 ;; Created: 25 Jul 1992
10 ;; This file is part of GNU Emacs.
12 ;; GNU Emacs is free software: you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation, either version 3 of the License, or
15 ;; (at your option) any later version.
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
27 ;; This game can be run in batch mode. To do this, use:
28 ;; emacs -batch -l dunnet
30 ;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
31 ;;; The log file should be set for your system, and it must
32 ;;; be writable by all.
37 "Text adventure for Emacs."
41 (defcustom dun-log-file
"/usr/local/dunnet.score"
42 "Name of file to store score information for dunnet."
46 ;;;; Mode definitions for interactive mode
48 (define-derived-mode dun-mode text-mode
"Dungeon"
49 "Major mode for running dunnet."
50 (make-local-variable 'scroll-step
)
53 (defun dun-parse (arg)
54 "Function called when return is pressed in interactive mode to parse line."
57 (let ((beg (1+ (point)))
60 (if (and (not (= beg
(point))) (not (< (point) beg
))
61 (string= ">" (buffer-substring (- beg
1) beg
)))
63 (setq line
(downcase (buffer-substring beg
(point))))
65 (if (eq (dun-vparse dun-ignore dun-verblist line
) -
1)
66 (dun-mprinc "I don't understand that.\n")))
67 (goto-char (point-max))
71 (defun dun-messages ()
74 (if (eq dungeon-mode
'dungeon
)
76 (if (not (= room dun-current-room
))
78 (dun-describe-room dun-current-room
)
79 (setq room dun-current-room
)))
86 "Switch to *dungeon* buffer and start game."
88 (switch-to-buffer "*dungeon*")
95 ;;;; This section contains all of the verbs and commands.
98 ;;; Give long description of room if haven't been there yet. Otherwise
99 ;;; short. Also give long if we were called with negative room number.
101 (defun dun-describe-room (room)
102 (if (and (not (member (abs room
) dun-light-rooms
))
103 (not (member obj-lamp dun-inventory
)))
104 (dun-mprincl "It is pitch dark. You are likely to be eaten by a grue.")
105 (dun-mprincl (cadr (nth (abs room
) dun-rooms
)))
106 (if (and (and (or (member room dun-visited
)
107 (string= dun-mode
"dun-superb")) (> room
0))
108 (not (string= dun-mode
"long")))
110 (dun-mprinc (car (nth (abs room
) dun-rooms
)))
112 (if (not (string= dun-mode
"long"))
113 (if (not (member (abs room
) dun-visited
))
114 (setq dun-visited
(append (list (abs room
)) dun-visited
))))
115 (dolist (xobjs (nth dun-current-room dun-room-objects
))
116 (if (= xobjs obj-special
)
119 (dun-mprincl (car (nth xobjs dun-objects
)))
120 (if (not (and (= xobjs obj-bus
) dun-inbus
))
122 (dun-mprincl (car (nth (abs xobjs
) dun-perm-objects
)))))))
123 (if (and (= xobjs obj-jar
) dun-jar
)
125 (dun-mprincl "The jar contains:")
128 (dun-mprincl (car (nth x dun-objects
)))))))
129 (if (and (member obj-bus
(nth dun-current-room dun-room-objects
)) dun-inbus
)
130 (dun-mprincl "You are on the bus."))))
132 ;;; There is a special object in the room. This object's description,
133 ;;; or lack thereof, depends on certain conditions.
135 (defun dun-special-object ()
136 (if (= dun-current-room computer-room
)
139 "The panel lights are flashing in a seemingly organized pattern.")
140 (dun-mprincl "The panel lights are steady and motionless.")))
142 (if (and (= dun-current-room red-room
)
143 (not (member obj-towel
(nth red-room dun-room-objects
))))
144 (dun-mprincl "There is a hole in the floor here."))
146 (if (and (= dun-current-room marine-life-area
) dun-black
)
148 "The room is lit by a black light, causing the fish, and some of
149 your objects, to give off an eerie glow."))
150 (if (and (= dun-current-room fourth-vermont-intersection
) dun-hole
)
154 (dun-mprincl"You fall into a hole in the ground.")
155 (setq dun-current-room vermont-station
)
156 (dun-describe-room vermont-station
))
159 "The bus falls down a hole in the ground and explodes.")
160 (dun-die "burning")))))
162 (if (> dun-current-room endgame-computer-room
)
164 (if (not dun-correct-answer
)
165 (dun-endgame-question)
166 (dun-mprincl "Your question is:")
167 (dun-mprincl dun-endgame-question
))))
169 (if (= dun-current-room sauna
)
171 (dun-mprincl (nth dun-sauna-level
'(
172 "It is normal room temperature in here."
173 "It is luke warm in here."
174 "It is comfortably hot in here."
175 "It is refreshingly hot in here."
176 "You are dead now.")))
177 (if (= dun-sauna-level
3)
179 (if (or (member obj-rms dun-inventory
)
180 (member obj-rms
(nth dun-current-room dun-room-objects
)))
183 "You notice the wax on your statuette beginning to melt, until it completely
184 melts off. You are left with a beautiful diamond!")
185 (if (member obj-rms dun-inventory
)
187 (dun-remove-obj-from-inven obj-rms
)
188 (setq dun-inventory
(append dun-inventory
189 (list obj-diamond
))))
190 (dun-remove-obj-from-room dun-current-room obj-rms
)
191 (dun-replace dun-room-objects dun-current-room
192 (append (nth dun-current-room dun-room-objects
)
193 (list obj-diamond
))))))
194 (if (or (member obj-floppy dun-inventory
)
195 (member obj-floppy
(nth dun-current-room dun-room-objects
)))
198 "You notice your floppy disk beginning to melt. As you grab for it, the
199 disk bursts into flames, and disintegrates.")
200 (dun-remove-obj-from-inven obj-floppy
)
201 (dun-remove-obj-from-room dun-current-room obj-floppy
))))))))
204 (defun dun-die (murderer)
207 (dun-mprincl "You are dead."))
208 (dun-do-logfile 'dun-die murderer
)
212 (defun dun-quit (args)
215 ;;; Print every object in player's inventory. Special case for the jar,
216 ;;; as we must also print what is in it.
218 (defun dun-inven (args)
219 (dun-mprinc "You currently have:")
221 (dolist (curobj dun-inventory
)
224 (dun-mprincl (cadr (nth curobj dun-objects
)))
225 (if (and (= curobj obj-jar
) dun-jar
)
227 (dun-mprincl "The jar contains:")
230 (dun-mprincl (cadr (nth x dun-objects
))))))))))
232 (defun dun-shake (obj)
234 (when (setq objnum
(dun-objnum-from-args-std obj
))
235 (if (member objnum dun-inventory
)
237 ;;; If shaking anything will do anything, put here.
238 (dun-mprinc "Shaking ")
239 (dun-mprinc (downcase (cadr (nth objnum dun-objects
))))
240 (dun-mprinc " seems to have no effect.")
243 (if (and (not (member objnum
(nth dun-current-room dun-room-silents
)))
244 (not (member objnum
(nth dun-current-room dun-room-objects
))))
245 (dun-mprincl "I don't see that here.")
246 ;;; Shaking trees can be deadly
247 (if (= objnum obj-tree
)
250 "You begin to shake a tree, and notice a coconut begin to fall from the air.
251 As you try to get your hand up to block it, you feel the impact as it lands
253 (dun-die "a coconut"))
254 (if (= objnum obj-bear
)
257 "As you go up to the bear, it removes your head and places it on the ground.")
260 (dun-mprincl "You cannot shake that.")
261 (dun-mprincl "You don't have that.")))))))))
264 (defun dun-drop (obj)
266 (dun-mprincl "You can't drop anything while on the bus.")
268 (when (setq objnum
(dun-objnum-from-args-std obj
))
269 (if (not (setq ptr
(member objnum dun-inventory
)))
270 (dun-mprincl "You don't have that.")
272 (dun-remove-obj-from-inven objnum
)
273 (dun-replace dun-room-objects dun-current-room
274 (append (nth dun-current-room dun-room-objects
)
276 (dun-mprincl "Done.")
277 (if (member objnum
(list obj-food obj-weight obj-jar
))
278 (dun-drop-check objnum
))))))))
280 ;;; Dropping certain things causes things to happen.
282 (defun dun-drop-check (objnum)
283 (if (and (= objnum obj-food
) (= room bear-hangout
)
284 (member obj-bear
(nth bear-hangout dun-room-objects
)))
287 "The bear takes the food and runs away with it. He left something behind.")
288 (dun-remove-obj-from-room dun-current-room obj-bear
)
289 (dun-remove-obj-from-room dun-current-room obj-food
)
290 (dun-replace dun-room-objects dun-current-room
291 (append (nth dun-current-room dun-room-objects
)
294 (if (and (= objnum obj-jar
) (member obj-nitric dun-jar
)
295 (member obj-glycerine dun-jar
))
298 "As the jar impacts the ground it explodes into many pieces.")
300 (dun-remove-obj-from-room dun-current-room obj-jar
)
301 (if (= dun-current-room fourth-vermont-intersection
)
304 (setq dun-current-room vermont-station
)
306 "The explosion causes a hole to open up in the ground, which you fall
309 (if (and (= objnum obj-weight
) (= dun-current-room maze-button-room
))
310 (dun-mprincl "A passageway opens.")))
312 ;;; Give long description of current room, or an object.
314 (defun dun-examine (obj)
316 (setq objnum
(dun-objnum-from-args obj
))
317 (if (eq objnum obj-special
)
318 (dun-describe-room (* dun-current-room -
1))
319 (if (and (eq objnum obj-computer
)
320 (member obj-pc
(nth dun-current-room dun-room-silents
)))
321 (dun-examine '("pc"))
323 (dun-mprincl "I don't know what that is.")
324 (if (and (not (member objnum
325 (nth dun-current-room dun-room-objects
)))
326 (not (and (member obj-jar dun-inventory
)
327 (member objnum dun-jar
)))
329 (nth dun-current-room dun-room-silents
)))
330 (not (member objnum dun-inventory
)))
331 (dun-mprincl "I don't see that here.")
333 (if (and (= objnum obj-bone
)
334 (= dun-current-room marine-life-area
) dun-black
)
336 "In this light you can see some writing on the bone. It says:
337 For an explosive time, go to Fourth St. and Vermont.")
338 (if (nth objnum dun-physobj-desc
)
339 (dun-mprincl (nth objnum dun-physobj-desc
))
340 (dun-mprincl "I see nothing special about that.")))
341 (if (nth (abs objnum
) dun-permobj-desc
)
343 (dun-mprincl (nth (abs objnum
) dun-permobj-desc
)))
344 (dun-mprincl "I see nothing special about that.")))))))))
346 (defun dun-take (obj)
347 (setq obj
(dun-firstword obj
))
349 (dun-mprincl "You must supply an object.")
350 (if (string= obj
"all")
353 (dun-mprincl "You can't take anything while on the bus.")
355 (dolist (x (nth dun-current-room dun-room-objects
))
356 (if (and (>= x
0) (not (= x obj-special
)))
359 (dun-mprinc (cadr (nth x dun-objects
)))
361 (dun-take-object x
))))
363 (dun-mprincl "Nothing to take."))))
365 (setq objnum
(cdr (assq (intern obj
) dun-objnames
)))
368 (dun-mprinc "I don't know what that is.")
370 (if (and dun-inbus
(not (and (member objnum dun-jar
)
371 (member obj-jar dun-inventory
))))
372 (dun-mprincl "You can't take anything while on the bus.")
373 (dun-take-object objnum
)))))))
375 (defun dun-take-object (objnum)
376 (if (and (member objnum dun-jar
) (member obj-jar dun-inventory
))
378 (dun-mprincl "You remove it from the jar.")
381 (if (not (= x objnum
))
382 (setq newjar
(append newjar
(list x
)))))
383 (setq dun-jar newjar
)
384 (setq dun-inventory
(append dun-inventory
(list objnum
))))
385 (if (not (member objnum
(nth dun-current-room dun-room-objects
)))
386 (if (not (member objnum
(nth dun-current-room dun-room-silents
)))
387 (dun-mprinc "I do not see that here.")
388 (dun-try-take objnum
))
391 (if (and (car dun-inventory
)
392 (> (+ (dun-inven-weight) (nth objnum dun-object-lbs
)) 11))
393 (dun-mprinc "Your load would be too heavy.")
394 (setq dun-inventory
(append dun-inventory
(list objnum
)))
395 (dun-remove-obj-from-room dun-current-room objnum
)
396 (dun-mprinc "Taken. ")
397 (if (and (= objnum obj-towel
) (= dun-current-room red-room
))
399 "Taking the towel reveals a hole in the floor."))))
400 (dun-try-take objnum
)))
403 (defun dun-inven-weight ()
407 (setq total
(+ total
(nth x dun-object-lbs
))))
408 (dolist (x dun-inventory
)
409 (setq total
(+ total
(nth x dun-object-lbs
)))) total
))
411 ;;; We try to take an object that is untakable. Print a message
412 ;;; depending on what it is.
414 (defun dun-try-take (obj)
415 (dun-mprinc "You cannot take that."))
417 (defun dun-dig (args)
419 (dun-mprincl "Digging here reveals nothing.")
420 (if (not (member 0 dun-inventory
))
421 (dun-mprincl "You have nothing with which to dig.")
422 (if (not (nth dun-current-room dun-diggables
))
423 (dun-mprincl "Digging here reveals nothing.")
424 (dun-mprincl "I think you found something.")
425 (dun-replace dun-room-objects dun-current-room
426 (append (nth dun-current-room dun-room-objects
)
427 (nth dun-current-room dun-diggables
)))
428 (dun-replace dun-diggables dun-current-room nil
)))))
430 (defun dun-climb (obj)
432 (setq objnum
(dun-objnum-from-args obj
))
434 (dun-mprincl "I don't know what that object is."))
435 ((and (not (eq objnum obj-special
))
436 (not (member objnum
(nth dun-current-room dun-room-objects
)))
437 (not (member objnum
(nth dun-current-room dun-room-silents
)))
438 (not (and (member objnum dun-jar
) (member obj-jar dun-inventory
)))
439 (not (member objnum dun-inventory
)))
440 (dun-mprincl "I don't see that here."))
441 ((and (eq objnum obj-special
)
442 (not (member obj-tree
(nth dun-current-room dun-room-silents
))))
443 (dun-mprincl "There is nothing here to climb."))
444 ((and (not (eq objnum obj-tree
)) (not (eq objnum obj-special
)))
445 (dun-mprincl "You can't climb that."))
448 "You manage to get about two feet up the tree and fall back down. You
449 notice that the tree is very unsteady.")))))
453 (when (setq objnum
(dun-objnum-from-args-std obj
))
454 (if (not (member objnum dun-inventory
))
455 (dun-mprincl "You don't have that.")
456 (if (not (= objnum obj-food
))
458 (dun-mprinc "You forcefully shove ")
459 (dun-mprinc (downcase (cadr (nth objnum dun-objects
))))
460 (dun-mprincl " down your throat, and start choking.")
462 (dun-mprincl "That tasted horrible.")
463 (dun-remove-obj-from-inven obj-food
))))))
465 (defun dun-put (args)
466 (let (newargs objnum objnum2 obj
)
467 (setq newargs
(dun-firstwordl args
))
469 (dun-mprincl "You must supply an object")
470 (setq obj
(intern (car newargs
)))
471 (setq objnum
(cdr (assq obj dun-objnames
)))
473 (dun-mprincl "I don't know what that object is.")
474 (if (not (member objnum dun-inventory
))
475 (dun-mprincl "You don't have that.")
476 (setq newargs
(dun-firstwordl (cdr newargs
)))
477 (setq newargs
(dun-firstwordl (cdr newargs
)))
479 (dun-mprincl "You must supply an indirect object.")
480 (setq objnum2
(cdr (assq (intern (car newargs
)) dun-objnames
)))
481 (if (and (eq objnum2 obj-computer
) (= dun-current-room pc-area
))
482 (setq objnum2 obj-pc
))
484 (dun-mprincl "I don't know what that indirect object is.")
485 (if (and (not (member objnum2
486 (nth dun-current-room dun-room-objects
)))
488 (nth dun-current-room dun-room-silents
)))
489 (not (member objnum2 dun-inventory
)))
490 (dun-mprincl "That indirect object is not here.")
491 (dun-put-objs objnum objnum2
)))))))))
493 (defun dun-put-objs (obj1 obj2
)
494 (if (and (= obj2 obj-drop
) (not dun-nomail
))
495 (setq obj2 obj-chute
))
497 (if (= obj2 obj-disposal
) (setq obj2 obj-chute
))
499 (if (and (= obj1 obj-cpu
) (= obj2 obj-computer
))
501 (dun-remove-obj-from-inven obj-cpu
)
502 (setq dun-computer t
)
504 "As you put the CPU board in the computer, it immediately springs to life.
505 The lights start flashing, and the fans seem to startup."))
506 (if (and (= obj1 obj-weight
) (= obj2 obj-button
))
507 (dun-drop '("weight"))
508 (if (= obj2 obj-jar
) ;; Put something in jar
509 (if (not (member obj1
(list obj-paper obj-diamond obj-emerald
510 obj-license obj-coins obj-egg
511 obj-nitric obj-glycerine
)))
512 (dun-mprincl "That will not fit in the jar.")
513 (dun-remove-obj-from-inven obj1
)
514 (setq dun-jar
(append dun-jar
(list obj1
)))
515 (dun-mprincl "Done."))
516 (if (= obj2 obj-chute
) ;; Put something in chute
518 (dun-remove-obj-from-inven obj1
)
520 "You hear it slide down the chute and off into the distance.")
521 (dun-put-objs-in-treas (list obj1
)))
522 (if (= obj2 obj-box
) ;; Put key in key box
526 "As you drop the key, the box begins to shake. Finally it explodes
527 with a bang. The key seems to have vanished!")
528 (dun-remove-obj-from-inven obj1
)
529 (dun-replace dun-room-objects computer-room
(append
533 (dun-remove-obj-from-room dun-current-room obj-box
)
534 (setq dun-key-level
(1+ dun-key-level
)))
535 (dun-mprincl "You can't put that in the key box!"))
537 (if (and (= obj1 obj-floppy
) (= obj2 obj-pc
))
540 (dun-remove-obj-from-inven obj1
)
541 (dun-mprincl "Done."))
543 (if (= obj2 obj-urinal
) ;; Put object in urinal
545 (dun-remove-obj-from-inven obj1
)
546 (dun-replace dun-room-objects urinal
(append
547 (nth urinal dun-room-objects
)
550 "You hear it plop down in some water below."))
551 (if (= obj2 obj-mail
)
552 (dun-mprincl "The mail chute is locked.")
553 (if (member obj1 dun-inventory
)
555 "I don't know how to combine those objects. Perhaps you should
556 just try dropping it.")
557 (dun-mprincl"You can't put that there.")))))))))))
559 (defun dun-type (args)
560 (if (not (= dun-current-room computer-room
))
561 (dun-mprincl "There is nothing here on which you could type.")
562 (if (not dun-computer
)
564 "You type on the keyboard, but your characters do not even echo.")
565 (dun-unix-interface))))
567 ;;; Various movement directions
582 (dun-move northeast
))
585 (dun-move southeast
))
588 (dun-move northwest
))
591 (dun-move southwest
))
596 (defun dun-down (args)
602 (defun dun-out (args)
606 (if (or (not (car args
))
607 (eq (dun-doverb dun-ignore dun-verblist
(car args
)
608 (cdr (cdr args
))) -
1))
609 (dun-mprinc "I don't understand where you want me to go.\n")))
611 ;;; Uses the dungeon-map to figure out where we are going. If the
612 ;;; requested direction yields 255, we know something special is
613 ;;; supposed to happen, or perhaps you can't go that way unless
614 ;;; certain conditions are met.
616 (defun dun-move (dir)
617 (if (and (not (member dun-current-room dun-light-rooms
))
618 (not (member obj-lamp dun-inventory
)))
621 "You trip over a grue and fall into a pit and break every bone in your
625 (setq newroom
(nth dir
(nth dun-current-room dungeon-map
)))
627 (dun-mprinc "You can't go that way.\n")
629 (dun-special-move dir
)
631 (setq dun-lastdir dir
)
634 (if (or (< newroom
58) (> newroom
83))
635 (dun-mprincl "The bus cannot go this way.")
637 "The bus lurches ahead and comes to a screeching halt.")
638 (dun-remove-obj-from-room dun-current-room obj-bus
)
639 (setq dun-current-room newroom
)
640 (dun-replace dun-room-objects newroom
641 (append (nth newroom dun-room-objects
)
643 (setq dun-current-room newroom
)))))))
645 ;;; Movement in this direction causes something special to happen if the
646 ;;; right conditions exist. It may be that you can't go this way unless
647 ;;; you have a key, or a passage has been opened.
649 ;;; coding note: Each check of the current room is on the same 'if' level,
650 ;;; i.e. there aren't else's. If two rooms next to each other have
651 ;;; specials, and they are connected by specials, this could cause
652 ;;; a problem. Be careful when adding them to consider this, and
653 ;;; perhaps use else's.
655 (defun dun-special-move (dir)
656 (if (= dun-current-room building-front
)
657 (if (not (member obj-key dun-inventory
))
658 (dun-mprincl "You don't have a key that can open this door.")
659 (setq dun-current-room old-building-hallway
))
660 (if (= dun-current-room north-end-of-cave-passage
)
663 "You must type a 3 digit combination code to enter this room.")
664 (dun-mprinc "Enter it here: ")
665 (setq combo
(dun-read-line))
666 (if (not dun-batch-mode
)
668 (if (string= combo dun-combination
)
669 (setq dun-current-room gamma-computing-center
)
670 (dun-mprincl "Sorry, that combination is incorrect."))))
672 (if (= dun-current-room bear-hangout
)
673 (if (member obj-bear
(nth bear-hangout dun-room-objects
))
676 "The bear is very annoyed that you would be so presumptuous as to try
677 and walk right by it. He tells you so by tearing your head off.
680 (dun-mprincl "You can't go that way.")))
682 (if (= dun-current-room vermont-station
)
685 "As you board the train it immediately leaves the station. It is a very
686 bumpy ride. It is shaking from side to side, and up and down. You
687 sit down in one of the chairs in order to be more comfortable.")
689 "\nFinally the train comes to a sudden stop, and the doors open, and some
690 force throws you out. The train speeds away.\n")
691 (setq dun-current-room museum-station
)))
693 (if (= dun-current-room old-building-hallway
)
694 (if (and (member obj-key dun-inventory
)
696 (setq dun-current-room meadow
)
697 (dun-mprincl "You don't have a key that can open this door.")))
699 (if (and (= dun-current-room maze-button-room
) (= dir northwest
))
700 (if (member obj-weight
(nth maze-button-room dun-room-objects
))
701 (setq dun-current-room
18)
702 (dun-mprincl "You can't go that way.")))
704 (if (and (= dun-current-room maze-button-room
) (= dir up
))
705 (if (member obj-weight
(nth maze-button-room dun-room-objects
))
706 (dun-mprincl "You can't go that way.")
707 (setq dun-current-room weight-room
)))
709 (if (= dun-current-room classroom
)
710 (dun-mprincl "The door is locked."))
712 (if (or (= dun-current-room lakefront-north
)
713 (= dun-current-room lakefront-south
))
716 (if (= dun-current-room reception-area
)
717 (if (not (= dun-sauna-level
3))
718 (setq dun-current-room health-club-front
)
720 "As you exit the building, you notice some flames coming out of one of the
721 windows. Suddenly, the building explodes in a huge ball of fire. The flames
722 engulf you, and you burn to death.")
723 (dun-die "burning")))
725 (if (= dun-current-room red-room
)
726 (if (not (member obj-towel
(nth red-room dun-room-objects
)))
727 (setq dun-current-room long-n-s-hallway
)
728 (dun-mprincl "You can't go that way.")))
730 (if (and (> dir down
) (> dun-current-room gamma-computing-center
)
731 (< dun-current-room museum-lobby
))
732 (if (not (member obj-bus
(nth dun-current-room dun-room-objects
)))
733 (dun-mprincl "You can't go that way.")
737 "You are already in the bus!")
738 (if (member obj-license dun-inventory
)
741 "You board the bus and get in the driver's seat.")
744 (dun-mprincl "You are not licensed for this type of vehicle.")))
746 (dun-mprincl "You are already off the bus!")
747 (dun-mprincl "You hop off the bus.")
748 (setq dun-inbus nil
))))
749 (if (= dun-current-room fifth-oaktree-intersection
)
752 (dun-mprincl "You fall down the cliff and land on your head.")
755 "The bus flies off the cliff, and plunges to the bottom, where it explodes.")
756 (dun-die "a bus accident")))
757 (if (= dun-current-room main-maple-intersection
)
760 (dun-mprincl "The gate will not open.")
762 "As the bus approaches, the gate opens and you drive through.")
763 (dun-remove-obj-from-room main-maple-intersection obj-bus
)
764 (dun-replace dun-room-objects museum-entrance
765 (append (nth museum-entrance dun-room-objects
)
767 (setq dun-current-room museum-entrance
)))))
768 (if (= dun-current-room cave-entrance
)
771 "As you enter the room you hear a rumbling noise. You look back to see
772 huge rocks sliding down from the ceiling, and blocking your way out.\n")
773 (setq dun-current-room misty-room
)))))
775 (defun dun-long (args)
776 (setq dun-mode
"long"))
778 (defun dun-turn (obj)
779 (let (objnum direction
)
780 (when (setq objnum
(dun-objnum-from-args-std obj
))
781 (if (not (or (member objnum
(nth dun-current-room dun-room-objects
))
782 (member objnum
(nth dun-current-room dun-room-silents
))))
783 (dun-mprincl "I don't see that here.")
784 (if (not (= objnum obj-dial
))
785 (dun-mprincl "You can't turn that.")
786 (setq direction
(dun-firstword (cdr obj
)))
787 (if (or (not direction
)
788 (not (or (string= direction
"clockwise")
789 (string= direction
"counterclockwise"))))
790 (dun-mprincl "You must indicate clockwise or counterclockwise.")
791 (if (string= direction
"clockwise")
792 (setq dun-sauna-level
(+ dun-sauna-level
1))
793 (setq dun-sauna-level
(- dun-sauna-level
1)))
795 (if (< dun-sauna-level
0)
798 "The dial will not turn further in that direction.")
799 (setq dun-sauna-level
0))
800 (dun-sauna-heat))))))))
802 (defun dun-sauna-heat ()
803 (if (= dun-sauna-level
0)
805 "The temperature has returned to normal room temperature."))
806 (if (= dun-sauna-level
1)
807 (dun-mprincl "It is now luke warm in here. You are perspiring."))
808 (if (= dun-sauna-level
2)
809 (dun-mprincl "It is pretty hot in here. It is still very comfortable."))
810 (if (= dun-sauna-level
3)
813 "It is now very hot. There is something very refreshing about this.")
814 (if (or (member obj-rms dun-inventory
)
815 (member obj-rms
(nth dun-current-room dun-room-objects
)))
818 "You notice the wax on your statuette beginning to melt, until it completely
819 melts off. You are left with a beautiful diamond!")
820 (if (member obj-rms dun-inventory
)
822 (dun-remove-obj-from-inven obj-rms
)
823 (setq dun-inventory
(append dun-inventory
824 (list obj-diamond
))))
825 (dun-remove-obj-from-room dun-current-room obj-rms
)
826 (dun-replace dun-room-objects dun-current-room
827 (append (nth dun-current-room dun-room-objects
)
828 (list obj-diamond
))))))
829 (if (or (member obj-floppy dun-inventory
)
830 (member obj-floppy
(nth dun-current-room dun-room-objects
)))
833 "You notice your floppy disk beginning to melt. As you grab for it, the
834 disk bursts into flames, and disintegrates.")
835 (if (member obj-floppy dun-inventory
)
836 (dun-remove-obj-from-inven obj-floppy
)
837 (dun-remove-obj-from-room dun-current-room obj-floppy
))))))
839 (if (= dun-sauna-level
4)
842 "As the dial clicks into place, you immediately burst into flames.")
843 (dun-die "burning"))))
845 (defun dun-press (obj)
847 (when (setq objnum
(dun-objnum-from-args-std obj
))
848 (if (not (or (member objnum
(nth dun-current-room dun-room-objects
))
849 (member objnum
(nth dun-current-room dun-room-silents
))))
850 (dun-mprincl "I don't see that here.")
851 (if (not (member objnum
(list obj-button obj-switch
)))
853 (dun-mprinc "You can't ")
854 (dun-mprinc (car line-list
))
855 (dun-mprincl " that."))
856 (if (= objnum obj-button
)
858 "As you press the button, you notice a passageway open up, but
859 as you release it, the passageway closes."))
860 (if (= objnum obj-switch
)
863 (dun-mprincl "The button is now in the off position.")
864 (setq dun-black nil
))
865 (dun-mprincl "The button is now in the on position.")
866 (setq dun-black t
))))))))
868 (defun dun-swim (args)
869 (if (not (member dun-current-room
(list lakefront-north lakefront-south
)))
870 (dun-mprincl "I see no water!")
871 (if (not (member obj-life dun-inventory
))
874 "You dive in the water, and at first notice it is quite cold. You then
875 start to get used to it as you realize that you never really learned how
877 (dun-die "drowning"))
878 (if (= dun-current-room lakefront-north
)
879 (setq dun-current-room lakefront-south
)
880 (setq dun-current-room lakefront-north
)))))
883 (defun dun-score (args)
884 (if (not dun-endgame
)
886 (setq total
(dun-reg-score))
887 (dun-mprinc "You have scored ")
889 (dun-mprincl " out of a possible 90 points.") total
)
890 (dun-mprinc "You have scored ")
891 (dun-mprinc (dun-endgame-score))
892 (dun-mprincl " endgame points out of a possible 110.")
893 (if (= (dun-endgame-score) 110)
895 "\n\nCongratulations. You have won. The wizard password is 'moby'"))))
897 (defun dun-help (args)
899 "Welcome to dunnet (2.01), by Ron Schnell (ronnie@driver-aces.com).
900 Here is some useful information (read carefully because there are one
901 or more clues in here):
902 - If you have a key that can open a door, you do not need to explicitly
903 open it. You may just use 'in' or walk in the direction of the door.
905 - If you have a lamp, it is always lit.
907 - You will not get any points until you manage to get treasures to a certain
908 place. Simply finding the treasures is not good enough. There is more
909 than one way to get a treasure to the special place. It is also
910 important that the objects get to the special place *unharmed* and
911 *untarnished*. You can tell if you have successfully transported the
912 object by looking at your score, as it changes immediately. Note that
913 an object can become harmed even after you have received points for it.
914 If this happens, your score will decrease, and in many cases you can never
915 get credit for it again.
917 - You can save your game with the 'save' command, and use restore it
918 with the 'restore' command.
920 - There are no limits on lengths of object names.
922 - Directions are: north,south,east,west,northeast,southeast,northwest,
923 southwest,up,down,in,out.
925 - These can be abbreviated: n,s,e,w,ne,se,nw,sw,u,d,in,out.
927 - If you go down a hole in the floor without an aid such as a ladder,
928 you probably won't be able to get back up the way you came, if at all.
930 - To run this game in batch mode (no Emacs window), use:
931 emacs -batch -l dunnet
932 NOTE: This game *should* be run in batch mode!
934 If you have questions or comments, please contact ronnie@driver-aces.com
935 My home page is http://www.driver-aces.com/ronnie.html
938 (defun dun-flush (args)
939 (if (not (= dun-current-room bathroom
))
940 (dun-mprincl "I see nothing to flush.")
941 (dun-mprincl "Whoooosh!!")
942 (dun-put-objs-in-treas (nth urinal dun-room-objects
))
943 (dun-replace dun-room-objects urinal nil
)))
945 (defun dun-piss (args)
946 (if (not (= dun-current-room bathroom
))
947 (dun-mprincl "You can't do that here, don't even bother trying.")
948 (if (not dun-gottago
)
949 (dun-mprincl "I'm afraid you don't have to go now.")
950 (dun-mprincl "That was refreshing.")
951 (setq dun-gottago nil
)
952 (dun-replace dun-room-objects urinal
(append
953 (nth urinal dun-room-objects
)
954 (list obj-URINE
))))))
957 (defun dun-sleep (args)
958 (if (not (= dun-current-room bedroom
))
960 "You try to go to sleep while standing up here, but can't seem to do it.")
963 "As soon as you start to doze off you begin dreaming. You see images of
964 workers digging caves, slaving in the humid heat. Then you see yourself
965 as one of these workers. While no one is looking, you leave the group
966 and walk into a room. The room is bare except for a horseshoe
967 shaped piece of stone in the center. You see yourself digging a hole in
968 the ground, then putting some kind of treasure in it, and filling the hole
969 with dirt again. After this, you immediately wake up.")))
971 (defun dun-break (obj)
973 (if (not (member obj-axe dun-inventory
))
974 (dun-mprincl "You have nothing you can use to break things.")
975 (when (setq objnum
(dun-objnum-from-args-std obj
))
976 (if (member objnum dun-inventory
)
979 "You take the object in your hands and swing the axe. Unfortunately, you miss
980 the object and slice off your hand. You bleed to death.")
982 (if (not (or (member objnum
(nth dun-current-room dun-room-objects
))
984 (nth dun-current-room dun-room-silents
))))
985 (dun-mprincl "I don't see that here.")
986 (if (= objnum obj-cable
)
989 "As you break the ethernet cable, everything starts to blur. You collapse
990 for a moment, then straighten yourself up.
992 (dun-replace dun-room-objects gamma-computing-center
994 (nth gamma-computing-center dun-room-objects
)
996 (if (member obj-key dun-inventory
)
998 (setq dun-inventory
(list obj-key
))
999 (dun-remove-obj-from-room
1000 gamma-computing-center obj-key
))
1001 (setq dun-inventory nil
))
1002 (setq dun-current-room computer-room
)
1003 (setq dun-ethernet nil
)
1004 (dun-mprincl "Connection closed.")
1005 (dun-unix-interface))
1008 (dun-mprincl "Your axe shatters into a million pieces.")
1009 (dun-remove-obj-from-inven obj-axe
))
1010 (dun-mprincl "Your axe breaks it into a million pieces.")
1011 (dun-remove-obj-from-room dun-current-room objnum
)))))))))
1013 (defun dun-drive (args)
1015 (dun-mprincl "You cannot drive when you aren't in a vehicle.")
1016 (dun-mprincl "To drive while you are in the bus, just give a direction.")))
1018 (defun dun-superb (args)
1019 (setq dun-mode
'dun-superb
))
1021 (defun dun-reg-score ()
1024 (dolist (x (nth treasure-room dun-room-objects
))
1025 (setq total
(+ total
(nth x dun-object-pts
))))
1026 (if (member obj-URINE
(nth treasure-room dun-room-objects
))
1027 (setq total
0)) total
))
1029 (defun dun-endgame-score ()
1032 (dolist (x (nth endgame-treasure-room dun-room-objects
))
1033 (setq total
(+ total
(nth x dun-object-pts
)))) total
))
1035 (defun dun-answer (args)
1036 (if (not dun-correct-answer
)
1037 (dun-mprincl "I don't believe anyone asked you anything.")
1038 (setq args
(car args
))
1040 (dun-mprincl "You must give the answer on the same line.")
1041 (if (dun-members args dun-correct-answer
)
1043 (dun-mprincl "Correct.")
1044 (if (= dun-lastdir
0)
1045 (setq dun-current-room
(1+ dun-current-room
))
1046 (setq dun-current-room
(- dun-current-room
1)))
1047 (setq dun-correct-answer nil
))
1048 (dun-mprincl "That answer is incorrect.")))))
1050 (defun dun-endgame-question ()
1051 (if (not dun-endgame-questions
)
1053 (dun-mprincl "Your question is:")
1054 (dun-mprincl "No more questions, just do 'answer foo'.")
1055 (setq dun-correct-answer
'("foo")))
1056 (let (which i newques
)
1059 (setq which
(random (length dun-endgame-questions
)))
1060 (dun-mprincl "Your question is:")
1061 (dun-mprincl (setq dun-endgame-question
(car
1063 dun-endgame-questions
))))
1064 (setq dun-correct-answer
(cdr (nth which dun-endgame-questions
)))
1066 (setq newques
(append newques
(list (nth i dun-endgame-questions
))))
1069 (while (< i
(length dun-endgame-questions
))
1070 (setq newques
(append newques
(list (nth i dun-endgame-questions
))))
1072 (setq dun-endgame-questions newques
))))
1074 (defun dun-power (args)
1075 (if (not (= dun-current-room pc-area
))
1076 (dun-mprincl "That operation is not applicable here.")
1077 (if (not dun-floppy
)
1079 (dun-dos-interface))))
1081 (defun dun-feed (args)
1083 (when (setq objnum
(dun-objnum-from-args-std args
))
1084 (if (and (= objnum obj-bear
)
1085 (member obj-bear
(nth dun-current-room dun-room-objects
)))
1087 (if (not (member obj-food dun-inventory
))
1088 (dun-mprincl "You have nothing with which to feed it.")
1089 (dun-drop '("food"))))
1090 (if (not (or (member objnum
(nth dun-current-room dun-room-objects
))
1091 (member objnum dun-inventory
)
1092 (member objnum
(nth dun-current-room dun-room-silents
))))
1093 (dun-mprincl "I don't see that here.")
1094 (dun-mprincl "You cannot feed that."))))))
1098 ;;;; This section defines various utility functions used
1103 ;;; Function which takes a verb and a list of other words. Calls proper
1104 ;;; function associated with the verb, and passes along the other words.
1106 (defun dun-doverb (dun-ignore dun-verblist verb rest
)
1109 (if (member (intern verb
) dun-ignore
)
1110 (if (not (car rest
)) -
1
1111 (dun-doverb dun-ignore dun-verblist
(car rest
) (cdr rest
)))
1112 (if (not (cdr (assq (intern verb
) dun-verblist
))) -
1
1113 (setq dun-numcmds
(1+ dun-numcmds
))
1114 (eval (list (cdr (assq (intern verb
) dun-verblist
)) (quote rest
)))))))
1117 ;;; Function to take a string and change it into a list of lowercase words.
1119 (defun dun-listify-string (strin)
1120 (let (pos ret-list end-pos
)
1123 (while (setq end-pos
(string-match "[ ,:;]" (substring strin pos
)))
1124 (setq end-pos
(+ end-pos pos
))
1125 (if (not (= end-pos pos
))
1126 (setq ret-list
(append ret-list
(list
1128 (substring strin pos end-pos
))))))
1129 (setq pos
(+ end-pos
1))) ret-list
))
1131 (defun dun-listify-string2 (strin)
1132 (let (pos ret-list end-pos
)
1135 (while (setq end-pos
(string-match " " (substring strin pos
)))
1136 (setq end-pos
(+ end-pos pos
))
1137 (if (not (= end-pos pos
))
1138 (setq ret-list
(append ret-list
(list
1140 (substring strin pos end-pos
))))))
1141 (setq pos
(+ end-pos
1))) ret-list
))
1143 (defun dun-replace (list n number
)
1144 (rplaca (nthcdr n list
) number
))
1147 ;;; Get the first non-ignored word from a list.
1149 (defun dun-firstword (list)
1150 (if (not (car list
))
1152 (while (and list
(member (intern (car list
)) dun-ignore
))
1153 (setq list
(cdr list
)))
1156 (defun dun-firstwordl (list)
1157 (if (not (car list
))
1159 (while (and list
(member (intern (car list
)) dun-ignore
))
1160 (setq list
(cdr list
)))
1163 ;;; parse a line passed in as a string Call the proper verb with the
1164 ;;; rest of the line passed in as a list.
1166 (defun dun-vparse (dun-ignore dun-verblist line
)
1168 (setq line-list
(dun-listify-string (concat line
" ")))
1169 (dun-doverb dun-ignore dun-verblist
(car line-list
) (cdr line-list
)))
1171 (defun dun-parse2 (dun-ignore dun-verblist line
)
1173 (setq line-list
(dun-listify-string2 (concat line
" ")))
1174 (dun-doverb dun-ignore dun-verblist
(car line-list
) (cdr line-list
)))
1176 ;;; Read a line, in window mode
1178 (defun dun-read-line ()
1180 (setq line
(read-string ""))
1181 (dun-mprinc line
) line
))
1183 ;;; Insert something into the window buffer
1185 (defun dun-minsert (string)
1186 (if (stringp string
)
1188 (insert (prin1-to-string string
))))
1190 ;;; Print something out, in window mode
1192 (defun dun-mprinc (string)
1193 (if (stringp string
)
1195 (insert (prin1-to-string string
))))
1197 ;;; In window mode, keep screen from jumping by keeping last line at
1198 ;;; the bottom of the screen.
1200 (defun dun-fix-screen ()
1202 (forward-line (- 0 (- (window-height) 2 )))
1203 (set-window-start (selected-window) (point))
1206 ;;; Insert something into the buffer, followed by newline.
1208 (defun dun-minsertl (string)
1209 (dun-minsert string
)
1212 ;;; Print something, followed by a newline.
1214 (defun dun-mprincl (string)
1218 ;;; Function which will get an object number given the list of
1219 ;;; words in the command, except for the verb.
1221 (defun dun-objnum-from-args (obj)
1223 (setq obj
(dun-firstword obj
))
1226 (setq objnum
(cdr (assq (intern obj
) dun-objnames
))))))
1228 (defun dun-objnum-from-args-std (obj)
1230 (if (eq (setq result
(dun-objnum-from-args obj
)) obj-special
)
1231 (dun-mprincl "You must supply an object."))
1233 (dun-mprincl "I don't know what that is."))
1234 (if (eq result obj-special
)
1238 ;;; Take a short room description, and change spaces and slashes to dashes.
1240 (defun dun-space-to-hyphen (string)
1242 (if (setq space
(string-match "[ /]" string
))
1244 (setq string
(concat (substring string
0 space
) "-"
1245 (substring string
(1+ space
))))
1246 (dun-space-to-hyphen string
))
1249 ;;; Given a unix style pathname, build a list of path components (recursive)
1251 (defun dun-get-path (dirstring startlist
)
1253 (if (= (length dirstring
) 0)
1255 (if (string= (substring dirstring
0 1) "/")
1256 (dun-get-path (substring dirstring
1) (append startlist
(list "/")))
1257 (if (not (setq slash
(string-match "/" dirstring
)))
1258 (append startlist
(list dirstring
))
1259 (dun-get-path (substring dirstring
(1+ slash
))
1261 (list (substring dirstring
0 slash
)))))))))
1264 ;;; Is a string a member of a string list?
1266 (defun dun-members (string string-list
)
1269 (dolist (x string-list
)
1270 (if (string= x string
)
1271 (setq found t
))) found
))
1273 ;;; Function to put objects in the treasure room. Also prints current
1274 ;;; score to let user know he has scored.
1276 (defun dun-put-objs-in-treas (objlist)
1277 (let (oscore newscore
)
1278 (setq oscore
(dun-reg-score))
1279 (dun-replace dun-room-objects
0 (append (nth 0 dun-room-objects
) objlist
))
1280 (setq newscore
(dun-reg-score))
1281 (if (not (= oscore newscore
))
1284 ;;; Load an encrypted file, and eval it.
1286 (defun dun-load-d (filename)
1287 (let (old-buffer result
)
1289 (setq old-buffer
(current-buffer))
1290 (switch-to-buffer (get-buffer-create "*loadc*"))
1293 (insert-file-contents filename
)
1294 (error (setq result nil
)))
1295 (unless (not result
)
1300 (kill-buffer (current-buffer)))
1301 (switch-to-buffer old-buffer
)
1304 ;;; Functions to remove an object either from a room, or from inventory.
1306 (defun dun-remove-obj-from-room (room objnum
)
1309 (dolist (x (nth room dun-room-objects
))
1310 (if (not (= x objnum
))
1311 (setq newroom
(append newroom
(list x
)))))
1312 (rplaca (nthcdr room dun-room-objects
) newroom
)))
1314 (defun dun-remove-obj-from-inven (objnum)
1316 (setq new-inven nil
)
1317 (dolist (x dun-inventory
)
1318 (if (not (= x objnum
))
1319 (setq new-inven
(append new-inven
(list x
)))))
1320 (setq dun-inventory new-inven
)))
1323 (let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper
)
1324 (setq dun-translate-table
(make-vector 256 0))
1326 (aset dun-translate-table i i
)
1328 (setq lower
(concat lower lower
))
1329 (setq upper
(upcase lower
))
1332 (aset dun-translate-table
(+ ?a i
) (aref lower
(+ i
13)))
1333 (aset dun-translate-table
(+ ?A i
) (aref upper
(+ i
13)))
1337 (let (str len
(i 0))
1338 (setq str
(buffer-substring (point-min) (point-max)))
1339 (setq len
(length str
))
1341 (aset str i
(aref dun-translate-table
(aref str i
)))
1347 ;;;; This section defines the globals that are used in dunnet.
1350 ;;;; All globals which can change must be saved from 'save-game. Add
1351 ;;;; all new globals to bottom of file.
1353 (setq dun-visited
'(27))
1354 (setq dun-current-room
1)
1355 (setq dun-exitf nil
)
1356 (setq dun-badcd nil
)
1357 (define-obsolete-variable-alias 'dungeon-mode-map
'dun-mode-map
"22.1")
1358 (define-key dun-mode-map
"\r" 'dun-parse
)
1359 (defvar dungeon-batch-map
(make-keymap))
1360 (if (string= (substring emacs-version
0 2) "18")
1363 (while (< 0 (setq n
(- n
1)))
1364 (aset dungeon-batch-map n
'dungeon-nil
)))
1367 (while (< 0 (setq n
(- n
1)))
1368 (aset (car (cdr dungeon-batch-map
)) n
'dungeon-nil
))))
1369 (define-key dungeon-batch-map
"\r" 'exit-minibuffer
)
1370 (define-key dungeon-batch-map
"\n" 'exit-minibuffer
)
1371 (setq dun-computer nil
)
1372 (setq dun-floppy nil
)
1373 (setq dun-key-level
0)
1375 (setq dun-correct-answer nil
)
1376 (setq dun-lastdir
0)
1377 (setq dun-numsaves
0)
1381 (setq dun-numcmds
0)
1382 (setq dun-wizard nil
)
1383 (setq dun-endgame-question nil
)
1384 (setq dun-logged-in nil
)
1385 (setq dungeon-mode
'dungeon
)
1386 (setq dun-unix-verbs
'((ls . dun-ls
) (ftp . dun-ftp
) (echo . dun-echo
)
1387 (exit . dun-uexit
) (cd . dun-cd
) (pwd . dun-pwd
)
1388 (rlogin . dun-rlogin
) (uncompress . dun-uncompress
)
1389 (cat . dun-cat
) (zippy . dun-zippy
)))
1391 (setq dun-dos-verbs
'((dir . dun-dos-dir
) (type . dun-dos-type
)
1392 (exit . dun-dos-exit
) (command . dun-dos-spawn
)
1393 (b: . dun-dos-invd
) (c: . dun-dos-invd
)
1394 (a: . dun-dos-nil
)))
1397 (setq dun-batch-mode nil
)
1399 (setq dun-cdpath
"/usr/toukmond")
1400 (setq dun-cdroom -
10)
1401 (setq dun-uncompressed nil
)
1402 (setq dun-ethernet t
)
1403 (setq dun-restricted
1404 '(dun-room-objects dungeon-map dun-rooms
1405 dun-room-silents dun-combination
))
1406 (setq dun-ftptype
'ascii
)
1407 (setq dun-endgame nil
)
1408 (setq dun-gottago t
)
1409 (setq dun-black nil
)
1413 "You are in the treasure room. A door leads out to the north."
1417 "You are at a dead end of a dirt road. The road goes to the east.
1418 In the distance you can see that it will eventually fork off. The
1419 trees here are very tall royal palms, and they are spaced equidistant
1424 "You are on the continuation of a dirt road. There are more trees on
1425 both sides of you. The road continues to the east and west."
1429 "You are at a fork of two passages, one to the northeast, and one to the
1430 southeast. The ground here seems very soft. You can also go back west."
1434 "You are on a northeast/southwest road."
1438 "You are at the end of the road. There is a building in front of you
1439 to the northeast, and the road leads back to the southwest."
1443 "You are on a southeast/northwest road."
1447 "You are standing at the end of a road. A passage leads back to the
1452 "You are in the hallway of an old building. There are rooms to the east
1453 and west, and doors leading out to the north and south."
1454 "Old Building hallway"
1457 "You are in a mailroom. There are many bins where the mail is usually
1458 kept. The exit is to the west."
1462 "You are in a computer room. It seems like most of the equipment has
1463 been removed. There is a VAX 11/780 in front of you, however, with
1464 one of the cabinets wide open. A sign on the front of the machine
1465 says: This VAX is named 'pokey'. To type on the console, use the
1466 'type' command. The exit is to the east."
1470 "You are in a meadow in the back of an old building. A small path leads
1471 to the west, and a door leads to the south."
1475 "You are in a round, stone room with a door to the east. There
1476 is a sign on the wall that reads: 'receiving room'."
1480 "You are at the south end of a hallway that leads to the north. There
1481 are rooms to the east and west."
1482 "Northbound Hallway"
1485 "You are in a sauna. There is nothing in the room except for a dial
1486 on the wall. A door leads out to west."
1490 "You are at the end of a north/south hallway. You can go back to the south,
1491 or off to a room to the east."
1492 "End of N/S Hallway"
1495 "You are in an old weight room. All of the equipment is either destroyed
1496 or completely broken. There is a door out to the west, and there is a ladder
1497 leading down a hole in the floor."
1501 "You are in a maze of twisty little passages, all alike.
1502 There is a button on the ground here."
1506 "You are in a maze of little twisty passages, all alike."
1510 "You are in a maze of thirsty little passages, all alike."
1514 "You are in a maze of twenty little passages, all alike."
1518 "You are in a daze of twisty little passages, all alike."
1522 "You are in a maze of twisty little cabbages, all alike."
1526 "You are in a reception area for a health and fitness center. The place
1527 appears to have been recently ransacked, and nothing is left. There is
1528 a door out to the south, and a crawlspace to the southeast."
1532 "You are outside a large building to the north which used to be a health
1533 and fitness center. A road leads to the south."
1537 "You are at the north side of a lake. On the other side you can see
1538 a road which leads to a cave. The water appears very deep."
1542 "You are at the south side of a lake. A road goes to the south."
1546 "You are in a well-hidden area off to the side of a road. Back to the
1547 northeast through the brush you can see the bear hangout."
1551 "The entrance to a cave is to the south. To the north, a road leads
1552 towards a deep lake. On the ground nearby there is a chute, with a sign
1553 that says 'put treasures here for points'."
1557 "You are in a misty, humid room carved into a mountain.
1558 To the north is the remains of a rockslide. To the east, a small
1559 passage leads away into the darkness." ;29
1563 "You are in an east/west passageway. The walls here are made of
1564 multicolored rock and are quite beautiful."
1565 "Cave E/W passage" ;30
1568 "You are at the junction of two passages. One goes north/south, and
1569 the other goes west."
1570 "N/S/W Junction" ;31
1573 "You are at the north end of a north/south passageway. There are stairs
1574 leading down from here. There is also a door leading west."
1575 "North end of cave passage" ;32
1578 "You are at the south end of a north/south passageway. There is a hole
1579 in the floor here, into which you could probably fit."
1580 "South end of cave passage" ;33
1583 "You are in what appears to be a worker's bedroom. There is a queen-
1584 sized bed in the middle of the room, and a painting hanging on the
1585 wall. A door leads to another room to the south, and stairways
1590 "You are in a bathroom built for workers in the cave. There is a
1591 urinal hanging on the wall, and some exposed pipes on the opposite
1592 wall where a sink used to be. To the north is a bedroom."
1596 "This is a marker for the urinal. User will not see this, but it
1597 is a room that can contain objects."
1601 "You are at the northeast end of a northeast/southwest passageway.
1602 Stairs lead up out of sight."
1603 "NE end of NE/SW cave passage" ;37
1606 "You are at the junction of northeast/southwest and east/west passages."
1607 "NE/SW-E/W junction" ;38
1610 "You are at the southwest end of a northeast/southwest passageway."
1611 "SW end of NE/SW cave passage" ;39
1614 "You are at the east end of an E/W passage. There are stairs leading up
1616 "East end of E/W cave passage" ;40
1619 "You are at the west end of an E/W passage. There is a hole on the ground
1620 which leads down out of sight."
1621 "West end of E/W cave passage" ;41
1624 "You are in a room which is bare, except for a horseshoe shaped boulder
1625 in the center. Stairs lead down from here." ;42
1626 "Horseshoe boulder room"
1629 "You are in a room which is completely empty. Doors lead out to the north
1634 "You are in an empty room. Interestingly enough, the stones in this
1635 room are painted blue. Doors lead out to the east and south." ;44
1639 "You are in an empty room. Interestingly enough, the stones in this
1640 room are painted yellow. Doors lead out to the south and west." ;45
1644 "You are in an empty room. Interestingly enough, the stones in this room
1645 are painted red. Doors lead out to the west and north."
1649 "You are in the middle of a long north/south hallway." ;47
1653 "You are 3/4 of the way towards the north end of a long north/south hallway."
1657 "You are at the north end of a long north/south hallway. There are stairs
1659 "North end of long hallway" ;49
1662 "You are 3/4 of the way towards the south end of a long north/south hallway."
1666 "You are at the south end of a long north/south hallway. There is a hole
1668 "South end of long hallway" ;51
1671 "You are at a landing in a stairwell which continues up and down."
1675 "You are at the continuation of an up/down staircase."
1676 "Up/down staircase" ;53
1679 "You are at the top of a staircase leading down. A crawlway leads off
1681 "Top of staircase." ;54
1684 "You are in a crawlway that leads northeast or southwest."
1688 "You are in a small crawlspace. There is a hole in the ground here, and
1689 a small passage back to the southwest."
1690 "Small crawlspace" ;56
1693 "You are in the Gamma Computing Center. An IBM 3090/600s is whirring
1694 away in here. There is an ethernet cable coming out of one of the units,
1695 and going through the ceiling. There is no console here on which you
1697 "Gamma computing center" ;57
1700 "You are near the remains of a post office. There is a mail drop on the
1701 face of the building, but you cannot see where it leads. A path leads
1702 back to the east, and a road leads to the north."
1706 "You are at the intersection of Main Street and Maple Ave. Main street
1707 runs north and south, and Maple Ave runs east off into the distance.
1708 If you look north and east you can see many intersections, but all of
1709 the buildings that used to stand here are gone. Nothing remains except
1711 There is a road to the northwest leading to a gate that guards a building."
1712 "Main-Maple intersection" ;59
1715 "You are at the intersection of Main Street and the west end of Oaktree Ave."
1716 "Main-Oaktree intersection" ;60
1719 "You are at the intersection of Main Street and the west end of Vermont Ave."
1720 "Main-Vermont intersection" ;61
1723 "You are at the north end of Main Street at the west end of Sycamore Ave." ;62
1724 "Main-Sycamore intersection"
1727 "You are at the south end of First Street at Maple Ave." ;63
1728 "First-Maple intersection"
1731 "You are at the intersection of First Street and Oaktree Ave." ;64
1732 "First-Oaktree intersection"
1735 "You are at the intersection of First Street and Vermont Ave." ;65
1736 "First-Vermont intersection"
1739 "You are at the north end of First Street at Sycamore Ave." ;66
1740 "First-Sycamore intersection"
1743 "You are at the south end of Second Street at Maple Ave." ;67
1744 "Second-Maple intersection"
1747 "You are at the intersection of Second Street and Oaktree Ave." ;68
1748 "Second-Oaktree intersection"
1751 "You are at the intersection of Second Street and Vermont Ave." ;69
1752 "Second-Vermont intersection"
1755 "You are at the north end of Second Street at Sycamore Ave." ;70
1756 "Second-Sycamore intersection"
1759 "You are at the south end of Third Street at Maple Ave." ;71
1760 "Third-Maple intersection"
1763 "You are at the intersection of Third Street and Oaktree Ave." ;72
1764 "Third-Oaktree intersection"
1767 "You are at the intersection of Third Street and Vermont Ave." ;73
1768 "Third-Vermont intersection"
1771 "You are at the north end of Third Street at Sycamore Ave." ;74
1772 "Third-Sycamore intersection"
1775 "You are at the south end of Fourth Street at Maple Ave." ;75
1776 "Fourth-Maple intersection"
1779 "You are at the intersection of Fourth Street and Oaktree Ave." ;76
1780 "Fourth-Oaktree intersection"
1783 "You are at the intersection of Fourth Street and Vermont Ave." ;77
1784 "Fourth-Vermont intersection"
1787 "You are at the north end of Fourth Street at Sycamore Ave." ;78
1788 "Fourth-Sycamore intersection"
1791 "You are at the south end of Fifth Street at the east end of Maple Ave." ;79
1792 "Fifth-Maple intersection"
1795 "You are at the intersection of Fifth Street and the east end of Oaktree Ave.
1796 There is a cliff off to the east."
1797 "Fifth-Oaktree intersection" ;80
1800 "You are at the intersection of Fifth Street and the east end of Vermont Ave."
1801 "Fifth-Vermont intersection" ;81
1804 "You are at the north end of Fifth Street and the east end of Sycamore Ave."
1805 "Fifth-Sycamore intersection" ;82
1808 "You are in front of the Museum of Natural History. A door leads into
1809 the building to the north, and a road leads to the southeast."
1810 "Museum entrance" ;83
1813 "You are in the main lobby for the Museum of Natural History. In the center
1814 of the room is the huge skeleton of a dinosaur. Doors lead out to the
1819 "You are in the geological display. All of the objects that used to
1820 be on display are missing. There are rooms to the east, west, and
1822 "Geological display" ;85
1825 "You are in the marine life area. The room is filled with fish tanks,
1826 which are filled with dead fish that have apparently died due to
1827 starvation. Doors lead out to the south and east."
1828 "Marine life area" ;86
1831 "You are in some sort of maintenance room for the museum. There is a
1832 switch on the wall labeled 'BL'. There are doors to the west and north."
1833 "Maintenance room" ;87
1836 "You are in a classroom where school children were taught about natural
1837 history. On the blackboard is written, 'No children allowed downstairs.'
1838 There is a door to the east with an 'exit' sign on it. There is another
1843 "You are at the Vermont St. subway station. A train is sitting here waiting."
1844 "Vermont station" ;89
1847 "You are at the Museum subway stop. A passage leads off to the north."
1848 "Museum station" ;90
1851 "You are in a north/south tunnel."
1855 "You are at the north end of a north/south tunnel. Stairs lead up and
1856 down from here. There is a garbage disposal here."
1857 "North end of N/S tunnel" ;92
1860 "You are at the top of some stairs near the subway station. There is
1861 a door to the west."
1862 "Top of subway stairs" ;93
1865 "You are at the bottom of some stairs near the subway station. There is
1866 a room to the northeast."
1867 "Bottom of subway stairs" ;94
1870 "You are in another computer room. There is a computer in here larger
1871 than you have ever seen. It has no manufacturers name on it, but it
1872 does have a sign that says: This machine's name is 'endgame'. The
1873 exit is to the southwest. There is no console here on which you could
1875 "Endgame computer room" ;95
1878 "You are in a north/south hallway."
1879 "Endgame N/S hallway" ;96
1882 "You have reached a question room. You must answer a question correctly in
1883 order to get by. Use the 'answer' command to answer the question."
1884 "Question room 1" ;97
1887 "You are in a north/south hallway."
1888 "Endgame N/S hallway" ;98
1891 "You are in a second question room."
1892 "Question room 2" ;99
1895 "You are in a north/south hallway."
1896 "Endgame N/S hallway" ;100
1899 "You are in a third question room."
1900 "Question room 3" ;101
1903 "You are in the endgame treasure room. A door leads out to the north, and
1904 a hallway leads to the south."
1905 "Endgame treasure room" ;102
1908 "You are in the winner's room. A door leads back to the south."
1909 "Winner's room" ;103
1912 "You have reached a dead end. There is a PC on the floor here. Above
1913 it is a sign that reads:
1914 Type the 'reset' command to type on the PC.
1915 A hole leads north."
1920 (setq dun-light-rooms
'(0 1 2 3 4 5 6 7 8 9 10 11 12 13 24 25 26 27 28 58 59
1921 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
1922 77 78 79 80 81 82 83))
1924 (setq dun-verblist
'((die . dun-die
) (ne . dun-ne
) (north . dun-n
)
1925 (south . dun-s
) (east . dun-e
) (west . dun-w
)
1926 (u . dun-up
) (d . dun-down
) (i . dun-inven
)
1927 (inventory . dun-inven
) (look . dun-examine
) (n . dun-n
)
1928 (s . dun-s
) (e . dun-e
) (w . dun-w
) (se . dun-se
)
1929 (nw . dun-nw
) (sw . dun-sw
) (up . dun-up
)
1930 (down . dun-down
) (in . dun-in
) (out . dun-out
)
1931 (go . dun-go
) (drop . dun-drop
) (southeast . dun-se
)
1932 (southwest . dun-sw
) (northeast . dun-ne
)
1933 (northwest . dun-nw
) (save . dun-save-game
)
1934 (restore . dun-restore
) (long . dun-long
) (dig . dun-dig
)
1935 (shake . dun-shake
) (wave . dun-shake
)
1936 (examine . dun-examine
) (describe . dun-examine
)
1937 (climb . dun-climb
) (eat . dun-eat
) (put . dun-put
)
1938 (type . dun-type
) (insert . dun-put
)
1939 (score . dun-score
) (help . dun-help
) (quit . dun-quit
)
1940 (read . dun-examine
) (verbose . dun-long
)
1941 (urinate . dun-piss
) (piss . dun-piss
)
1942 (flush . dun-flush
) (sleep . dun-sleep
) (lie . dun-sleep
)
1943 (x . dun-examine
) (break . dun-break
) (drive . dun-drive
)
1944 (board . dun-in
) (enter . dun-in
) (turn . dun-turn
)
1945 (press . dun-press
) (push . dun-press
) (swim . dun-swim
)
1946 (on . dun-in
) (off . dun-out
) (chop . dun-break
)
1947 (switch . dun-press
) (cut . dun-break
) (exit . dun-out
)
1948 (leave . dun-out
) (reset . dun-power
) (flick . dun-press
)
1949 (superb . dun-superb
) (answer . dun-answer
)
1950 (throw . dun-drop
) (l . dun-examine
) (take . dun-take
)
1951 (get . dun-take
) (feed . dun-feed
)))
1953 (setq dun-inbus nil
)
1954 (setq dun-nomail nil
)
1955 (setq dun-ignore
'(the to at
))
1956 (setq dun-mode
'moby
)
1957 (setq dun-sauna-level
0)
1963 (defconst northeast
4)
1964 (defconst southeast
5)
1965 (defconst northwest
6)
1966 (defconst southwest
7)
1972 (setq dungeon-map
'(
1973 ; no so ea we ne se nw sw up do in ot
1974 ( 96 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;0
1975 ( -
1 -
1 2 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;1
1976 ( -
1 -
1 3 1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;2
1977 ( -
1 -
1 -
1 2 4 6 -
1 -
1 -
1 -
1 -
1 -
1 ) ;3
1978 ( -
1 -
1 -
1 -
1 5 -
1 -
1 3 -
1 -
1 -
1 -
1 ) ;4
1979 ( -
1 -
1 -
1 -
1 255 -
1 -
1 4 -
1 -
1 255 -
1 ) ;5
1980 ( -
1 -
1 -
1 -
1 -
1 7 3 -
1 -
1 -
1 -
1 -
1 ) ;6
1981 ( -
1 -
1 -
1 -
1 -
1 255 6 27 -
1 -
1 -
1 -
1 ) ;7
1982 ( 255 5 9 10 -
1 -
1 -
1 5 -
1 -
1 -
1 5 ) ;8
1983 ( -
1 -
1 -
1 8 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;9
1984 ( -
1 -
1 8 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;10
1985 ( -
1 8 -
1 58 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;11
1986 ( -
1 -
1 13 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;12
1987 ( 15 -
1 14 12 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;13
1988 ( -
1 -
1 -
1 13 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;14
1989 ( -
1 13 16 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;15
1990 ( -
1 -
1 -
1 15 -
1 -
1 -
1 -
1 -
1 17 16 -
1 ) ;16
1991 ( -
1 -
1 17 17 17 17 255 17 255 17 -
1 -
1 ) ;17
1992 ( 18 18 18 18 18 -
1 18 18 19 18 -
1 -
1 ) ;18
1993 ( -
1 18 18 19 19 20 19 19 -
1 18 -
1 -
1 ) ;19
1994 ( -
1 -
1 -
1 18 -
1 -
1 -
1 -
1 -
1 21 -
1 -
1 ) ;20
1995 ( -
1 -
1 -
1 -
1 -
1 20 22 -
1 -
1 -
1 -
1 -
1 ) ;21
1996 ( 18 18 18 18 16 18 23 18 18 18 18 18 ) ;22
1997 ( -
1 255 -
1 -
1 -
1 19 -
1 -
1 -
1 -
1 -
1 -
1 ) ;23
1998 ( 23 25 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;24
1999 ( 24 255 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 255 -
1 ) ;25
2000 (255 28 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 255 -
1 ) ;26
2001 ( -
1 -
1 -
1 -
1 7 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;27
2002 ( 26 255 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 255 -
1 ) ;28
2003 ( -
1 -
1 30 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;29
2004 ( -
1 -
1 31 29 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;30
2005 ( 32 33 -
1 30 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;31
2006 ( -
1 31 -
1 255 -
1 -
1 -
1 -
1 -
1 34 -
1 -
1 ) ;32
2007 ( 31 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 35 -
1 -
1 ) ;33
2008 ( -
1 35 -
1 -
1 -
1 -
1 -
1 -
1 32 37 -
1 -
1 ) ;34
2009 ( 34 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;35
2010 ( -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;36
2011 ( -
1 -
1 -
1 -
1 -
1 -
1 -
1 38 34 -
1 -
1 -
1 ) ;37
2012 ( -
1 -
1 40 41 37 -
1 -
1 39 -
1 -
1 -
1 -
1 ) ;38
2013 ( -
1 -
1 -
1 -
1 38 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;39
2014 ( -
1 -
1 -
1 38 -
1 -
1 -
1 -
1 42 -
1 -
1 -
1 ) ;40
2015 ( -
1 -
1 38 -
1 -
1 -
1 -
1 -
1 -
1 43 -
1 -
1 ) ;41
2016 ( -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 40 -
1 -
1 ) ;42
2017 ( 44 -
1 46 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;43
2018 ( -
1 43 45 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;44
2019 ( -
1 46 -
1 44 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;45
2020 ( 45 -
1 -
1 43 -
1 -
1 -
1 -
1 -
1 255 -
1 -
1 ) ;46
2021 ( 48 50 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;47
2022 ( 49 47 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;48
2023 ( -
1 48 -
1 -
1 -
1 -
1 -
1 -
1 52 -
1 -
1 -
1 ) ;49
2024 ( 47 51 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;50
2025 ( 50 104 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;51
2026 ( -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 53 49 -
1 -
1 ) ;52
2027 ( -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 54 52 -
1 -
1 ) ;53
2028 ( -
1 -
1 -
1 -
1 55 -
1 -
1 -
1 -
1 53 -
1 -
1 ) ;54
2029 ( -
1 -
1 -
1 -
1 56 -
1 -
1 54 -
1 -
1 -
1 54 ) ;55
2030 ( -
1 -
1 -
1 -
1 -
1 -
1 -
1 55 -
1 31 -
1 -
1 ) ;56
2031 ( -
1 -
1 32 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;57
2032 ( 59 -
1 11 -
1 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;58
2033 ( 60 58 63 -
1 -
1 -
1 255 -
1 -
1 -
1 255 255) ;59
2034 ( 61 59 64 -
1 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;60
2035 ( 62 60 65 -
1 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;61
2036 ( -
1 61 66 -
1 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;62
2037 ( 64 -
1 67 59 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;63
2038 ( 65 63 68 60 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;64
2039 ( 66 64 69 61 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;65
2040 ( -
1 65 70 62 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;66
2041 ( 68 -
1 71 63 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;67
2042 ( 69 67 72 64 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;68
2043 ( 70 68 73 65 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;69
2044 ( -
1 69 74 66 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;70
2045 ( 72 -
1 75 67 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;71
2046 ( 73 71 76 68 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;72
2047 ( 74 72 77 69 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;73
2048 ( -
1 73 78 70 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;74
2049 ( 76 -
1 79 71 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;75
2050 ( 77 75 80 72 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;76
2051 ( 78 76 81 73 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;77
2052 ( -
1 77 82 74 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;78
2053 ( 80 -
1 -
1 75 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;79
2054 ( 81 79 255 76 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;80
2055 ( 82 80 -
1 77 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;81
2056 ( -
1 81 -
1 78 -
1 -
1 -
1 -
1 -
1 -
1 255 255) ;82
2057 ( 84 -
1 -
1 -
1 -
1 59 -
1 -
1 -
1 -
1 255 255) ;83
2058 ( -
1 83 85 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;84
2059 ( 86 -
1 87 84 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;85
2060 ( -
1 85 88 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;86
2061 ( 88 -
1 -
1 85 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;87
2062 ( -
1 87 255 86 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;88
2063 ( -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 255 -
1 ) ;89
2064 ( 91 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;90
2065 ( 92 90 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;91
2066 ( -
1 91 -
1 -
1 -
1 -
1 -
1 -
1 93 94 -
1 -
1 ) ;92
2067 ( -
1 -
1 -
1 88 -
1 -
1 -
1 -
1 -
1 92 -
1 -
1 ) ;93
2068 ( -
1 -
1 -
1 -
1 95 -
1 -
1 -
1 92 -
1 -
1 -
1 ) ;94
2069 ( -
1 -
1 -
1 -
1 -
1 -
1 -
1 94 -
1 -
1 -
1 -
1 ) ;95
2070 ( 97 0 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;96
2071 ( -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;97
2072 ( 99 97 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;98
2073 ( -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;99
2074 ( 101 99 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;100
2075 ( -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;101
2076 ( 103 101 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;102
2077 ( -
1 102 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;103
2078 ( 51 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 -
1 ) ;104
2080 ; no so ea we ne se nw sw up do in ot
2084 ;;; How the user references *all* objects, permanent and regular.
2085 (setq dun-objnames
'(
2088 (cpu .
2) (board .
2) (card .
2) (chip .
2)
2091 (paper .
5) (slip .
5)
2092 (rms .
6) (statue .
6) (statuette .
6) (stallman .
6)
2095 (life .
9) (preserver .
9)
2096 (bracelet .
10) (emerald .
10)
2099 (towel .
13) (beach .
13)
2107 (acid .
21) (nitric .
21)
2113 (floppy .
27) (disk .
27)
2116 (tree . -
2) (trees . -
2) (palm . -
2)
2118 (bin . -
4) (bins . -
4)
2119 (cabinet . -
5) (computer . -
5) (vax . -
5) (ibm . -
5)
2128 (pipes . -
14) (pipe . -
14)
2129 (box . -
15) (slit . -
15)
2130 (cable . -
16) (ethernet . -
16)
2131 (mail . -
17) (drop . -
17)
2135 (skeleton . -
21) (dinosaur . -
21)
2137 (tanks . -
23) (tank . -
23)
2140 (disposal . -
26) (garbage . -
26)
2142 (subway . -
28) (train . -
28)
2143 (pc . -
29) (drive . -
29) (coconut . -
30) (coconuts . -
30)
2144 (lake . -
32) (water . -
32)
2147 (dolist (x dun-objnames
)
2149 (setq name
(concat "obj-" (prin1-to-string (car x
))))
2150 (eval (list 'defconst
(intern name
) (cdr x
)))))
2152 (defconst obj-special
255)
2154 ;;; The initial setup of what objects are in each room.
2155 ;;; Regular objects have whole numbers lower than 255.
2156 ;;; Objects that cannot be taken but might move and are
2157 ;;; described during room description are negative.
2158 ;;; Stuff that is described and might change are 255, and are
2159 ;;; handled specially by 'dun-describe-room.
2161 (setq dun-room-objects
(list nil
2163 (list obj-shovel
) ;; treasure-room
2164 (list obj-boulder
) ;; dead-end
2166 (list obj-food
) ;; se-nw-road
2167 (list obj-bear
) ;; bear-hangout
2169 (list obj-special
) ;; computer-room
2170 (list obj-lamp obj-license obj-silver
);; meadow
2172 (list obj-special
) ;; sauna
2174 (list obj-weight obj-life
) ;; weight-room
2176 (list obj-rms obj-floppy
) ;; thirsty-maze
2177 nil nil nil nil nil nil nil
2178 (list obj-emerald
) ;; hidden-area
2180 (list obj-gold
) ;; misty-room
2181 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
2182 (list obj-towel obj-special
) ;; red-room
2184 (list obj-box
) ;; stair-landing
2186 (list obj-axe
) ;; smal-crawlspace
2187 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
2189 (list obj-special
) ;; fourth-vermont-intersection
2191 (list obj-coins
) ;; fifth-oaktree-intersection
2193 (list obj-bus
) ;; fifth-sycamore-intersection
2195 (list obj-bone
) ;; museum-lobby
2197 (list obj-jar obj-special obj-ruby
) ;; marine-life-area
2198 (list obj-nitric
) ;; maintenance-room
2199 (list obj-glycerine
) ;; classroom
2201 (list obj-amethyst
) ;; bottom-of-subway-stairs
2203 (list obj-special
) ;; question-room-1
2205 (list obj-special
) ;; question-room-2
2207 (list obj-special
) ;; question-room-three
2209 (list obj-mona
) ;; winner's-room
2210 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
2211 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
2212 nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
2215 ;;; These are objects in a room that are only described in the
2216 ;;; room description. They are permanent.
2218 (setq dun-room-silents
(list nil
2219 (list obj-tree obj-coconut
) ;; dead-end
2220 (list obj-tree obj-coconut
) ;; e-w-dirt-road
2221 nil nil nil nil nil nil
2222 (list obj-bin
) ;; mailroom
2223 (list obj-computer
) ;; computer-room
2225 (list obj-dial
) ;; sauna
2227 (list obj-ladder
) ;; weight-room
2228 (list obj-button obj-ladder
) ;; maze-button-room
2231 (list obj-lake
) ;; lakefront-north
2232 (list obj-lake
) ;; lakefront-south
2234 (list obj-chute
) ;; cave-entrance
2236 (list obj-painting obj-bed
) ;; bedroom
2237 (list obj-urinal obj-pipes
) ;; bathroom
2238 nil nil nil nil nil nil
2239 (list obj-boulder
) ;; horseshoe-boulder-room
2240 nil nil nil nil nil nil nil nil nil nil nil nil nil nil
2241 (list obj-computer obj-cable
) ;; gamma-computing-center
2242 (list obj-mail
) ;; post-office
2243 (list obj-gate
) ;; main-maple-intersection
2244 nil nil nil nil nil nil nil nil nil nil nil nil nil
2245 nil nil nil nil nil nil nil
2246 (list obj-cliff
) ;; fifth-oaktree-intersection
2248 (list obj-dinosaur
) ;; museum-lobby
2250 (list obj-fish obj-tanks
) ;; marine-life-area
2251 (list obj-switch
) ;; maintenance-room
2252 (list obj-blackboard
) ;; classroom
2253 (list obj-train
) ;; vermont-station
2255 (list obj-disposal
) ;; north-end-of-n-s-tunnel
2257 (list obj-computer
) ;; endgame-computer-room
2258 nil nil nil nil nil nil nil nil
2259 (list obj-pc
) ;; pc-area
2260 nil nil nil nil nil nil
2262 (setq dun-inventory
'(1))
2264 ;;; Descriptions of objects, as they appear in the room description, and
2267 (setq dun-objects
'(
2268 ("There is a shovel here." "A shovel") ;0
2269 ("There is a lamp nearby." "A lamp") ;1
2270 ("There is a CPU card here." "A computer board") ;2
2271 ("There is some food here." "Some food") ;3
2272 ("There is a shiny brass key here." "A brass key") ;4
2273 ("There is a slip of paper here." "A slip of paper") ;5
2274 ("There is a wax statuette of Richard Stallman here." ;6
2276 ("There is a shimmering diamond here." "A diamond") ;7
2277 ("There is a 10 pound weight here." "A weight") ;8
2278 ("There is a life preserver here." "A life preserver");9
2279 ("There is an emerald bracelet here." "A bracelet") ;10
2280 ("There is a gold bar here." "A gold bar") ;11
2281 ("There is a platinum bar here." "A platinum bar") ;12
2282 ("There is a beach towel on the ground here." "A beach towel")
2283 ("There is an axe here." "An axe") ;14
2284 ("There is a silver bar here." "A silver bar") ;15
2285 ("There is a bus driver's license here." "A license") ;16
2286 ("There are some valuable coins here." "Some valuable coins")
2287 ("There is a jewel-encrusted egg here." "A valuable egg") ;18
2288 ("There is a glass jar here." "A glass jar") ;19
2289 ("There is a dinosaur bone here." "A bone") ;20
2290 ("There is a packet of nitric acid here." "Some nitric acid")
2291 ("There is a packet of glycerine here." "Some glycerine") ;22
2292 ("There is a valuable ruby here." "A ruby") ;23
2293 ("There is a valuable amethyst here." "An amethyst") ;24
2294 ("The Mona Lisa is here." "The Mona Lisa") ;25
2295 ("There is a 100 dollar bill here." "A $100 bill") ;26
2296 ("There is a floppy disk here." "A floppy disk") ;27
2300 ;;; Weight of objects
2302 (setq dun-object-lbs
2303 '(2 1 1 1 1 0 2 2 10 3 1 1 1 0 1 1 0 1 1 1 1 0 0 2 2 1 0 0))
2304 (setq dun-object-pts
2305 '(0 0 0 0 0 0 0 10 0 0 10 10 10 0 0 10 0 10 10 0 0 0 0 10 10 10 10 0))
2308 ;;; Unix representation of objects.
2309 (setq dun-objfiles
'(
2310 "shovel.o" "lamp.o" "cpu.o" "food.o" "key.o" "paper.o"
2311 "rms.o" "diamond.o" "weight.o" "preserver.o" "bracelet.o"
2312 "gold.o" "platinum.o" "towel.o" "axe.o" "silver.o" "license.o"
2313 "coins.o" "egg.o" "jar.o" "bone.o" "nitric.o" "glycerine.o"
2314 "ruby.o" "amethyst.o"
2317 ;;; These are the descriptions for the negative numbered objects from
2318 ;;; dun-room-objects
2320 (setq dun-perm-objects
'(
2322 ("There is a large boulder here.")
2324 ("There is a ferocious bear here!")
2327 ("There is a worthless pile of protoplasm here.")
2334 ("There is a strange smell in this room.")
2337 "There is a box with a slit in it, bolted to the wall here."
2341 ("There is a bus here.")
2348 ;;; These are the descriptions the user gets when regular objects are
2351 (setq dun-physobj-desc
'(
2352 "It is a normal shovel with a price tag attached that says $19.99."
2353 "The lamp is hand-crafted by Geppetto."
2354 "The CPU board has a VAX chip on it. It seems to have
2355 2 Megabytes of RAM onboard."
2356 "It looks like some kind of meat. Smells pretty bad."
2358 "The paper says: Don't forget to type 'help' for help. Also, remember
2360 "The statuette is of the likeness of Richard Stallman, the author of the
2361 famous EMACS editor. You notice that he is not wearing any shoes."
2363 "You observe that the weight is heavy."
2364 "It says S. S. Minnow."
2368 "It has a picture of snoopy on it."
2371 "It has your picture on it!"
2372 "They are old coins from the 19th century."
2373 "It is a valuable Fabrege egg."
2374 "It is a plain glass jar."
2383 ;;; These are the descriptions the user gets when non-regular objects
2386 (setq dun-permobj-desc
'(
2388 "It is just a boulder. It cannot be moved."
2389 "They are palm trees with a bountiful supply of coconuts in them."
2390 "It looks like a grizzly to me."
2391 "All of the bins are empty. Looking closely you can see that there
2392 are names written at the bottom of each bin, but most of them are
2393 faded away so that you cannot read them. You can only make out three
2400 "It is just a garbled mess."
2401 "The dial points to a temperature scale which has long since faded away."
2404 "It is a velvet painting of Elvis Presley. It seems to be nailed to the
2405 wall, and you cannot move it."
2406 "It is a queen sized bed, with a very firm mattress."
2407 "The urinal is very clean compared with everything else in the cave. There
2408 isn't even any rust. Upon close examination you realize that the drain at the
2409 bottom is missing, and there is just a large hole leading down the
2410 pipes into nowhere. The hole is too small for a person to fit in. The
2411 flush handle is so clean that you can see your reflection in it."
2414 "The box has a slit in the top of it, and on it, in sloppy handwriting, is
2415 written: 'For key upgrade, put key in here.'"
2417 "It says 'express mail' on it."
2418 "It is a 35 passenger bus with the company name 'mobytours' on it."
2419 "It is a large metal gate that is too big to climb over."
2420 "It is a HIGH cliff."
2421 "Unfortunately you do not know enough about dinosaurs to tell very much about
2422 it. It is very big, though."
2423 "The fish look like they were once quite beautiful."
2428 "It is a normal ladder that is permanently attached to the hole."
2429 "It is a passenger train that is ready to go."
2430 "It is a personal computer that has only one floppy disk drive."
2435 (list nil nil nil
(list obj-cpu
) nil nil nil nil nil nil nil
2436 nil nil nil nil nil nil nil nil nil nil
;11-20
2437 nil nil nil nil nil nil nil nil nil nil
;21-30
2438 nil nil nil nil nil nil nil nil nil nil
;31-40
2439 nil
(list obj-platinum
) nil nil nil nil nil nil nil nil
))
2441 (setq dun-room-shorts nil
)
2442 (dolist (x dun-rooms
)
2443 (setq dun-room-shorts
2444 (append dun-room-shorts
(list (downcase
2445 (dun-space-to-hyphen
2448 (setq dun-endgame-questions
'(
2450 "What is your password on the machine called 'pokey'?" "robert")
2452 "What password did you use during anonymous ftp to gamma?" "foo")
2454 "Excluding the endgame, how many places are there where you can put
2455 treasures for points?" "4" "four")
2457 "What is your login name on the 'endgame' machine?" "toukmond"
2460 "What is the nearest whole dollar to the price of the shovel?" "20" "twenty")
2462 "What is the name of the bus company serving the town?" "mobytours")
2464 "Give either of the two last names in the mailroom, other than your own."
2467 "What cartoon character is on the towel?" "snoopy")
2469 "What is the last name of the author of EMACS?" "stallman")
2471 "How many megabytes of memory is on the CPU board for the Vax?" "2")
2473 "Which street in town is named after a U.S. state?" "vermont")
2475 "How many pounds did the weight weigh?" "ten" "10")
2477 "Name the STREET which runs right over the subway stop." "fourth" "4" "4th")
2479 "How many corners are there in town (excluding the one with the Post Office)?"
2480 "24" "twentyfour" "twenty-four")
2482 "What type of bear was hiding your key?" "grizzly")
2484 "Name either of the two objects you found by digging." "cpu" "card" "vax"
2487 "What network protocol is used between pokey and gamma?" "tcp/ip" "ip" "tcp")
2492 (dolist (x dun-room-shorts
)
2493 (eval (list 'defconst
(intern x
) a
))
2499 ;;;; This section defines the UNIX emulation functions for dunnet.
2502 (defun dun-unix-parse (args)
2506 (setq beg
(+ (point) 2))
2508 (if (and (not (= beg
(point)))
2509 (string= "$" (buffer-substring (- beg
2) (- beg
1))))
2511 (setq line
(downcase (buffer-substring beg
(point))))
2513 (if (eq (dun-parse2 nil dun-unix-verbs line
) -
1)
2515 (if (setq esign
(string-match "=" line
))
2516 (dun-doassign line esign
)
2517 (dun-mprinc (car line-list
))
2518 (dun-mprincl ": not found.")))))
2519 (goto-char (point-max))
2521 (if (eq dungeon-mode
'unix
)
2524 (dun-mprinc "$ ")))))
2526 (defun dun-doassign (line esign
)
2527 (if (not dun-wizard
)
2529 (dun-mprinc "Enter wizard password: ")
2530 (setq passwd
(dun-read-line))
2531 (if (not dun-batch-mode
)
2533 (if (string= passwd
"moby")
2536 (dun-doassign line esign
))
2537 (dun-mprincl "Incorrect.")))
2539 (let (varname epoint afterq i value
)
2540 (setq varname
(substring line
0 esign
))
2541 (if (not (setq epoint
(string-match ")" line
)))
2542 (if (string= (substring line
(1+ esign
) (+ esign
2))
2545 (setq afterq
(substring line
(+ esign
2)))
2547 (string-match "\"" afterq
)
2550 (if (not (setq epoint
(string-match " " line
)))
2551 (setq epoint
(length line
))))
2552 (setq epoint
(1+ epoint
))
2554 (not (= epoint
(length line
)))
2555 (setq i
(string-match ")" (substring line epoint
))))
2556 (setq epoint
(+ epoint i
1))))
2557 (setq value
(substring line
(1+ esign
) epoint
))
2558 (dun-eval varname value
))))
2560 (defun dun-eval (varname value
)
2562 (switch-to-buffer (get-buffer-create "*dungeon-eval*"))
2569 (setq eval-error nil
)
2572 (error (setq eval-error t
)))
2573 (kill-buffer (current-buffer))
2574 (switch-to-buffer "*dungeon*")
2576 (dun-mprincl "Invalid syntax."))))
2579 (defun dun-unix-interface ()
2583 (setq dungeon-mode
'unix
)
2584 (define-key dun-mode-map
"\r" 'dun-unix-parse
)
2585 (dun-mprinc "$ "))))
2588 (let (tries username password
)
2590 (while (and (not dun-logged-in
) (> (setq tries
(- tries
1)) 0))
2591 (dun-mprinc "\n\nUNIX System V, Release 2.2 (pokey)\n\nlogin: ")
2592 (setq username
(dun-read-line))
2593 (if (not dun-batch-mode
)
2595 (dun-mprinc "password: ")
2596 (setq password
(dun-read-line))
2597 (if (not dun-batch-mode
)
2599 (if (or (not (string= username
"toukmond"))
2600 (not (string= password
"robert")))
2601 (dun-mprincl "login incorrect")
2602 (setq dun-logged-in t
)
2605 Please clean up your directories. The filesystem is getting full.
2606 Our tcp/ip link to gamma is a little flaky, but seems to work.
2607 The current version of ftp can only send files from your home
2608 directory, and deletes them after they are sent! Be careful.
2610 Note: Restricted bourne shell in use.\n")))
2611 (setq dungeon-mode
'dungeon
)))
2613 (defun dun-ls (args)
2615 (let (ocdpath ocdroom
)
2616 (setq ocdpath dun-cdpath
)
2617 (setq ocdroom dun-cdroom
)
2618 (if (not (eq (dun-cd args
) -
2))
2620 (setq dun-cdpath ocdpath
)
2621 (setq dun-cdroom ocdroom
))
2622 (if (= dun-cdroom -
10)
2624 (if (= dun-cdroom -
2)
2626 (if (= dun-cdroom -
3)
2628 (if (= dun-cdroom -
4)
2630 (if (> dun-cdroom
0)
2633 (defun dun-ls-root ()
2634 (dun-mprincl "total 4
2635 drwxr-xr-x 3 root staff 512 Jan 1 1970 .
2636 drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..
2637 drwxr-xr-x 3 root staff 2048 Jan 1 1970 usr
2638 drwxr-xr-x 3 root staff 2048 Jan 1 1970 rooms"))
2640 (defun dun-ls-usr ()
2641 (dun-mprincl "total 4
2642 drwxr-xr-x 3 root staff 512 Jan 1 1970 .
2643 drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..
2644 drwxr-xr-x 3 toukmond restricted 512 Jan 1 1970 toukmond"))
2646 (defun dun-ls-rooms ()
2647 (dun-mprincl "total 16
2648 drwxr-xr-x 3 root staff 512 Jan 1 1970 .
2649 drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..")
2650 (dolist (x dun-visited
)
2652 "drwxr-xr-x 3 root staff 512 Jan 1 1970 ")
2653 (dun-mprincl (nth x dun-room-shorts
))))
2655 (defun dun-ls-room ()
2656 (dun-mprincl "total 4
2657 drwxr-xr-x 3 root staff 512 Jan 1 1970 .
2658 drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..
2659 -rwxr-xr-x 3 root staff 2048 Jan 1 1970 description")
2660 (dolist (x (nth dun-cdroom dun-room-objects
))
2661 (if (and (>= x
0) (not (= x
255)))
2663 (dun-mprinc "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ")
2664 (dun-mprincl (nth x dun-objfiles
))))))
2666 (defun dun-ls-inven ()
2667 (dun-mprinc "total 467
2668 drwxr-xr-x 3 toukmond restricted 512 Jan 1 1970 .
2669 drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..")
2670 (dolist (x dun-unix-verbs
)
2671 (if (not (eq (car x
) 'IMPOSSIBLE
))
2674 -rwxr-xr-x 1 toukmond restricted 10423 Jan 1 1970 ")
2675 (dun-mprinc (car x
)))))
2677 (if (not dun-uncompressed
)
2679 "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 paper.o.Z"))
2680 (dolist (x dun-inventory
)
2682 "-rwxr-xr-x 1 toukmond restricted 0 Jan 1 1970 ")
2683 (dun-mprincl (nth x dun-objfiles
))))
2685 (defun dun-echo (args)
2691 (if (not (string= (substring x
0 1) "$"))
2695 (setq var
(intern (substring x
1)))
2696 (if (not (boundp var
))
2698 (if (member var dun-restricted
)
2701 (dun-mprinc ": Permission denied")
2703 (eval (list 'dun-mprinc var
))
2704 (dun-mprinc " ")))))))
2708 (defun dun-ftp (args)
2709 (let (host username passwd ident newlist
)
2710 (if (not (car args
))
2711 (dun-mprincl "ftp: hostname required on command line.")
2712 (setq host
(intern (car args
)))
2713 (if (not (member host
'(gamma dun-endgame
)))
2714 (dun-mprincl "ftp: Unknown host.")
2715 (if (eq host
'dun-endgame
)
2716 (dun-mprincl "ftp: connection to endgame not allowed")
2717 (if (not dun-ethernet
)
2718 (dun-mprincl "ftp: host not responding.")
2719 (dun-mprincl "Connected to gamma. FTP ver 0.9 00:00:00 01/01/70")
2720 (dun-mprinc "Username: ")
2721 (setq username
(dun-read-line))
2722 (if (string= username
"toukmond")
2724 (dun-mprincl "toukmond ftp access not allowed.")
2725 (dun-mprincl "\ntoukmond ftp access not allowed."))
2726 (if (string= username
"anonymous")
2729 "Guest login okay, send your user ident as password.")
2731 "\nGuest login okay, send your user ident as password."))
2733 (dun-mprinc "Password required for ")
2734 (dun-mprinc "\nPassword required for "))
2735 (dun-mprincl username
))
2736 (dun-mprinc "Password: ")
2737 (setq ident
(dun-read-line))
2738 (if (not (string= username
"anonymous"))
2740 (dun-mprincl "Login failed.")
2741 (dun-mprincl "\nLogin failed."))
2744 "Guest login okay, user access restrictions apply.")
2746 "\nGuest login okay, user access restrictions apply."))
2749 '("What password did you use during anonymous ftp to gamma?"))
2750 (setq newlist
(append newlist
(list ident
)))
2751 (rplaca (nthcdr 1 dun-endgame-questions
) newlist
)))))))))
2753 (defun dun-ftp-commands ()
2754 (setq dun-exitf nil
)
2756 (while (not dun-exitf
)
2757 (dun-mprinc "ftp> ")
2758 (setq line
(dun-read-line))
2762 '((type . dun-ftptype
) (binary . dun-bin
) (bin . dun-bin
)
2763 (send . dun-send
) (put . dun-send
) (quit . dun-ftpquit
)
2764 (help . dun-ftphelp
)(ascii . dun-fascii
)
2767 (dun-mprincl "No such command. Try help.")))
2768 (setq dun-ftptype
'ascii
)))
2770 (defun dun-ftptype (args)
2771 (if (not (car args
))
2772 (dun-mprincl "Usage: type [binary | ascii]")
2773 (setq args
(intern (car args
)))
2774 (if (eq args
'binary
)
2776 (if (eq args
'ascii
)
2778 (dun-mprincl "Unknown type.")))))
2780 (defun dun-bin (args)
2781 (dun-mprincl "Type set to binary.")
2782 (setq dun-ftptype
'binary
))
2784 (defun dun-fascii (args)
2785 (dun-mprincl "Type set to ascii.")
2786 (setq dun-ftptype
'ascii
))
2788 (defun dun-ftpquit (args)
2791 (defun dun-send (args)
2792 (if (not (car args
))
2793 (dun-mprincl "Usage: send <filename>")
2794 (setq args
(car args
))
2799 ;;; User can send commands! Stupid user.
2802 (if (assq (intern args
) dun-unix-verbs
)
2804 (rplaca (assq (intern args
) dun-unix-verbs
) 'IMPOSSIBLE
)
2805 (dun-mprinc "Sending ")
2806 (dun-mprinc dun-ftptype
)
2807 (dun-mprinc " file for ")
2809 (dun-mprincl "Transfer complete."))
2811 (dolist (x dun-objfiles
)
2812 (if (string= args x
)
2814 (if (not (member counter dun-inventory
))
2816 (dun-mprincl "No such file.")
2818 (dun-mprinc "Sending ")
2819 (dun-mprinc dun-ftptype
)
2820 (dun-mprinc " file for ")
2821 (dun-mprinc (downcase (cadr (nth counter dun-objects
))))
2822 (dun-mprincl ", (0 bytes)")
2823 (if (not (eq dun-ftptype
'binary
))
2825 (if (not (member obj-protoplasm
2828 (dun-replace dun-room-objects receiving-room
2829 (append (nth receiving-room
2831 (list obj-protoplasm
))))
2832 (dun-remove-obj-from-inven counter
))
2833 (dun-remove-obj-from-inven counter
)
2834 (dun-replace dun-room-objects receiving-room
2835 (append (nth receiving-room dun-room-objects
)
2838 (dun-mprincl "Transfer complete."))))
2839 (setq counter
(+ 1 counter
)))
2841 (dun-mprincl "No such file."))))))
2843 (defun dun-ftphelp (args)
2845 "Possible commands are:\nsend quit type ascii binary help"))
2847 (defun dun-uexit (args)
2848 (setq dungeon-mode
'dungeon
)
2849 (dun-mprincl "\nYou step back from the console.")
2850 (define-key dun-mode-map
"\r" 'dun-parse
)
2851 (if (not dun-batch-mode
)
2854 (defun dun-pwd (args)
2855 (dun-mprincl dun-cdpath
))
2857 (defun dun-uncompress (args)
2858 (if (not (car args
))
2859 (dun-mprincl "Usage: uncompress <filename>")
2860 (setq args
(car args
))
2861 (if (or dun-uncompressed
2862 (and (not (string= args
"paper.o"))
2863 (not (string= args
"paper.o.z"))))
2864 (dun-mprincl "Uncompress command failed.")
2865 (setq dun-uncompressed t
)
2866 (setq dun-inventory
(append dun-inventory
(list obj-paper
))))))
2868 (defun dun-rlogin (args)
2870 (if (not (car args
))
2871 (dun-mprincl "Usage: rlogin <hostname>")
2872 (setq args
(car args
))
2873 (if (string= args
"endgame")
2874 (dun-rlogin-endgame)
2875 (if (not (string= args
"gamma"))
2876 (if (string= args
"pokey")
2877 (dun-mprincl "Can't rlogin back to localhost")
2878 (dun-mprincl "No such host."))
2879 (if (not dun-ethernet
)
2880 (dun-mprincl "Host not responding.")
2881 (dun-mprinc "Password: ")
2882 (setq passwd
(dun-read-line))
2883 (if (not (string= passwd
"worms"))
2884 (dun-mprincl "\nlogin incorrect")
2886 "\nYou begin to feel strange for a moment, and you lose your items."
2888 (dun-replace dun-room-objects computer-room
2889 (append (nth computer-room dun-room-objects
)
2891 (setq dun-inventory nil
)
2892 (setq dun-current-room receiving-room
)
2893 (dun-uexit nil
))))))))
2895 (defun dun-cd (args)
2896 (let (tcdpath tcdroom path-elements room-check
)
2897 (if (not (car args
))
2898 (dun-mprincl "Usage: cd <path>")
2899 (setq tcdpath dun-cdpath
)
2900 (setq tcdroom dun-cdroom
)
2901 (setq dun-badcd nil
)
2903 (setq path-elements
(dun-get-path (car args
) nil
))
2904 (error (dun-mprincl "Invalid path")
2905 (setq dun-badcd t
)))
2906 (dolist (pe path-elements
)
2908 (if (not (string= pe
"."))
2909 (if (string= pe
"..")
2911 (if (> tcdroom
0) ;In a room
2913 (setq tcdpath
"/rooms")
2915 ;In /rooms,/usr,root
2917 (= tcdroom -
2) (= tcdroom -
4)
2922 (if (= tcdroom -
10) ;In /usr/toukmond
2924 (setq tcdpath
"/usr")
2925 (setq tcdroom -
4))))))
2926 (if (string= pe
"/")
2931 (if (string= pe
"toukmond")
2933 (setq tcdpath
"/usr/toukmond")
2942 (if (string= pe
"rooms")
2944 (setq tcdpath
"/rooms")
2946 (if (string= pe
"usr")
2948 (setq tcdpath
"/usr")
2953 (dolist (x dun-visited
)
2957 (if (string= room-check pe
)
2960 (concat "/rooms/" room-check
))
2963 (dun-nosuchdir)))))))))))))
2966 (setq dun-cdpath tcdpath
)
2967 (setq dun-cdroom tcdroom
)
2971 (defun dun-nosuchdir ()
2972 (dun-mprincl "No such directory.")
2975 (defun dun-cat (args)
2976 (let (doto checklist
)
2977 (if (not (setq args
(car args
)))
2978 (dun-mprincl "Usage: cat <ascii-file-name>")
2979 (if (string-match "/" args
)
2980 (dun-mprincl "cat: only files in current directory allowed.")
2981 (if (and (> dun-cdroom
0) (string= args
"description"))
2982 (dun-mprincl (car (nth dun-cdroom dun-rooms
)))
2983 (if (setq doto
(string-match "\\.o" args
))
2985 (if (= dun-cdroom -
10)
2986 (setq checklist dun-inventory
)
2987 (setq checklist
(nth dun-cdroom dun-room-objects
)))
2988 (if (not (member (cdr
2990 (substring args
0 doto
))
2993 (dun-mprincl "File not found.")
2994 (dun-mprincl "Ascii files only.")))
2995 (if (assq (intern args
) dun-unix-verbs
)
2996 (dun-mprincl "Ascii files only.")
2997 (dun-mprincl "File not found."))))))))
2999 (defun dun-zippy (args)
3000 (dun-mprincl (yow)))
3002 (defun dun-rlogin-endgame ()
3003 (if (not (= (dun-score nil
) 90))
3005 "You have not achieved enough points to connect to endgame.")
3006 (dun-mprincl"\nWelcome to the endgame. You are a truly noble adventurer.")
3007 (setq dun-current-room treasure-room
)
3008 (setq dun-endgame t
)
3009 (dun-replace dun-room-objects endgame-treasure-room
(list obj-bill
))
3014 (setq tloc
(+ 60 (random 18)))
3015 (dun-replace dun-room-objects tloc
3016 (append (nth tloc dun-room-objects
) (list 18)))
3018 (setq tcomb
(+ 100 (random 899)))
3019 (setq dun-combination
(prin1-to-string tcomb
))
3022 ;;;; This section defines the DOS emulation functions for dunnet
3025 (defun dun-dos-parse (args)
3029 (setq beg
(+ (point) 3))
3031 (if (not (= beg
(point)))
3033 (setq line
(downcase (buffer-substring beg
(point))))
3035 (if (eq (dun-parse2 nil dun-dos-verbs line
) -
1)
3038 (dun-mprincl "Bad command or file name"))))
3039 (goto-char (point-max))
3041 (if (eq dungeon-mode
'dos
)
3044 (dun-dos-prompt)))))
3046 (defun dun-dos-interface ()
3048 (setq dungeon-mode
'dos
)
3049 (define-key dun-mode-map
"\r" 'dun-dos-parse
)
3052 (defun dun-dos-type (args)
3054 (if (setq args
(car args
))
3055 (if (string= args
"foo.txt")
3056 (dun-dos-show-combination)
3057 (if (string= args
"command.com")
3058 (dun-mprincl "Cannot type binary files")
3059 (dun-mprinc "File not found - ")
3060 (dun-mprincl (upcase args
))))
3061 (dun-mprincl "Must supply file name")))
3063 (defun dun-dos-invd (args)
3065 (dun-mprincl "Invalid drive specification"))
3067 (defun dun-dos-dir (args)
3069 (if (or (not (setq args
(car args
))) (string= args
"\\"))
3071 Volume in drive A is FOO
3072 Volume Serial Number is 1A16-08C9
3075 COMMAND COM 47845 04-09-91 2:00a
3076 FOO TXT 40 01-20-93 1:01a
3077 2 file(s) 47845 bytes
3081 Volume in drive A is FOO
3082 Volume Serial Number is 1A16-08C9
3088 (defun dun-dos-prompt ()
3091 (defun dun-dos-boot-msg ()
3093 (dun-mprinc "Current time is ")
3094 (dun-mprincl (substring (current-time-string) 12 20))
3095 (dun-mprinc "Enter new time: ")
3097 (if (not dun-batch-mode
)
3100 (defun dun-dos-spawn (args)
3102 (dun-mprincl "Cannot spawn subshell"))
3104 (defun dun-dos-exit (args)
3105 (setq dungeon-mode
'dungeon
)
3106 (dun-mprincl "\nYou power down the machine and step back.")
3107 (define-key dun-mode-map
"\r" 'dun-parse
)
3108 (if (not dun-batch-mode
)
3111 (defun dun-dos-no-disk ()
3113 (dun-mprincl "Boot sector not found"))
3116 (defun dun-dos-show-combination ()
3118 (dun-mprinc "\nThe combination is ")
3119 (dun-mprinc dun-combination
)
3122 (defun dun-dos-nil (args))
3126 ;;;; This section defines the save and restore game functions for dunnet.
3129 (defun dun-save-game (filename)
3130 (if (not (setq filename
(car filename
)))
3131 (dun-mprincl "You must supply a filename for the save.")
3132 (if (file-exists-p filename
)
3133 (delete-file filename
))
3134 (setq dun-numsaves
(1+ dun-numsaves
))
3135 (dun-make-save-buffer)
3136 (dun-save-val "dun-current-room")
3137 (dun-save-val "dun-computer")
3138 (dun-save-val "dun-combination")
3139 (dun-save-val "dun-visited")
3140 (dun-save-val "dun-diggables")
3141 (dun-save-val "dun-key-level")
3142 (dun-save-val "dun-floppy")
3143 (dun-save-val "dun-numsaves")
3144 (dun-save-val "dun-numcmds")
3145 (dun-save-val "dun-logged-in")
3146 (dun-save-val "dungeon-mode")
3147 (dun-save-val "dun-jar")
3148 (dun-save-val "dun-lastdir")
3149 (dun-save-val "dun-black")
3150 (dun-save-val "dun-nomail")
3151 (dun-save-val "dun-unix-verbs")
3152 (dun-save-val "dun-hole")
3153 (dun-save-val "dun-uncompressed")
3154 (dun-save-val "dun-ethernet")
3155 (dun-save-val "dun-sauna-level")
3156 (dun-save-val "dun-room-objects")
3157 (dun-save-val "dun-room-silents")
3158 (dun-save-val "dun-inventory")
3159 (dun-save-val "dun-endgame-questions")
3160 (dun-save-val "dun-endgame")
3161 (dun-save-val "dun-cdroom")
3162 (dun-save-val "dun-cdpath")
3163 (dun-save-val "dun-correct-answer")
3164 (dun-save-val "dun-inbus")
3165 (if (dun-compile-save-out filename
)
3166 (dun-mprincl "Error saving to file.")
3167 (dun-do-logfile 'save nil
)
3168 (switch-to-buffer "*dungeon*")
3170 (dun-mprincl "Done."))))
3172 (defun dun-make-save-buffer ()
3173 (switch-to-buffer (get-buffer-create "*save-dungeon*"))
3176 (defun dun-compile-save-out (filename)
3181 (error (setq ferror t
)))
3184 (goto-char (point-min))))
3186 (write-region 1 (point-max) filename nil
1)
3187 (error (setq ferror t
)))
3188 (kill-buffer (current-buffer))
3192 (defun dun-save-val (varname)
3194 (setq varname
(intern varname
))
3195 (setq value
(eval varname
))
3196 (dun-minsert "(setq ")
3197 (dun-minsert varname
)
3199 (if (or (listp value
)
3207 (dun-minsertl ")")))
3210 (defun dun-restore (args)
3212 (if (not (setq file
(car args
)))
3213 (dun-mprincl "You must supply a filename.")
3214 (if (not (dun-load-d file
))
3215 (dun-mprincl "Could not load restore file.")
3216 (dun-mprincl "Done.")
3220 (defun dun-do-logfile (type how
)
3221 (let (ferror newscore
)
3223 (switch-to-buffer (get-buffer-create "*score*"))
3226 (insert-file-contents dun-log-file
)
3227 (error (setq ferror t
)))
3229 (goto-char (point-max))
3230 (dun-minsert (current-time-string))
3232 (dun-minsert (user-login-name))
3235 (dun-minsert "saved ")
3236 (if (= (dun-endgame-score) 110)
3237 (dun-minsert "won ")
3239 (dun-minsert "quit ")
3240 (dun-minsert "killed by ")
3242 (dun-minsert " "))))
3244 (dun-minsert (cadr (nth (abs room
) dun-rooms
)))
3245 (dun-minsert ". score: ")
3246 (if (> (dun-endgame-score) 0)
3247 (dun-minsert (setq newscore
(+ 90 (dun-endgame-score))))
3248 (dun-minsert (setq newscore
(dun-reg-score))))
3249 (dun-minsert " saves: ")
3250 (dun-minsert dun-numsaves
)
3251 (dun-minsert " commands: ")
3252 (dun-minsert dun-numcmds
)
3254 (write-region 1 (point-max) dun-log-file nil
1))
3255 (kill-buffer (current-buffer))))
3259 ;;;; These are functions, and function re-definitions so that dungeon can
3260 ;;;; be run in batch mode.
3263 (defun dun-batch-mprinc (arg)
3265 (send-string-to-terminal arg
)
3266 (send-string-to-terminal (prin1-to-string arg
))))
3269 (defun dun-batch-mprincl (arg)
3272 (send-string-to-terminal arg
)
3273 (send-string-to-terminal "\n"))
3274 (send-string-to-terminal (prin1-to-string arg
))
3275 (send-string-to-terminal "\n")))
3277 (defun dun-batch-parse (dun-ignore dun-verblist line
)
3278 (setq line-list
(dun-listify-string (concat line
" ")))
3279 (dun-doverb dun-ignore dun-verblist
(car line-list
) (cdr line-list
)))
3281 (defun dun-batch-parse2 (dun-ignore dun-verblist line
)
3282 (setq line-list
(dun-listify-string2 (concat line
" ")))
3283 (dun-doverb dun-ignore dun-verblist
(car line-list
) (cdr line-list
)))
3285 (defun dun-batch-read-line ()
3286 (read-from-minibuffer "" nil dungeon-batch-map
))
3289 (defun dun-batch-loop ()
3292 (while (not dun-dead
)
3293 (if (eq dungeon-mode
'dungeon
)
3295 (if (not (= room dun-current-room
))
3297 (dun-describe-room dun-current-room
)
3298 (setq room dun-current-room
)))
3300 (setq line
(downcase (dun-read-line)))
3301 (if (eq (dun-vparse dun-ignore dun-verblist line
) -
1)
3302 (dun-mprinc "I don't understand that.\n"))))))
3304 (defun dun-batch-dos-interface ()
3306 (setq dungeon-mode
'dos
)
3307 (while (eq dungeon-mode
'dos
)
3309 (setq line
(downcase (dun-read-line)))
3310 (if (eq (dun-parse2 nil dun-dos-verbs line
) -
1)
3313 (dun-mprincl "Bad command or file name"))))
3314 (goto-char (point-max))
3317 (defun dun-batch-unix-interface ()
3321 (setq dungeon-mode
'unix
)
3322 (while (eq dungeon-mode
'unix
)
3324 (setq line
(downcase (dun-read-line)))
3325 (if (eq (dun-parse2 nil dun-unix-verbs line
) -
1)
3327 (if (setq esign
(string-match "=" line
))
3328 (dun-doassign line esign
)
3329 (dun-mprinc (car line-list
))
3330 (dun-mprincl ": not found.")))))
3331 (goto-char (point-max))
3332 (dun-mprinc "\n"))))
3334 (defun dungeon-nil (arg)
3339 (defun dun-batch-dungeon ()
3341 (setq dun-visited
'(27))
3345 (unless (not noninteractive
)
3346 (fset 'dun-mprinc
'dun-batch-mprinc
)
3347 (fset 'dun-mprincl
'dun-batch-mprincl
)
3348 (fset 'dun-vparse
'dun-batch-parse
)
3349 (fset 'dun-parse2
'dun-batch-parse2
)
3350 (fset 'dun-read-line
'dun-batch-read-line
)
3351 (fset 'dun-dos-interface
'dun-batch-dos-interface
)
3352 (fset 'dun-unix-interface
'dun-batch-unix-interface
)
3354 (setq dun-batch-mode t
)
3359 ;;; dunnet.el ends here