searchcode logo
Dogecoin is an open source peer-to-peer cryptocurrency

progressive-gc-emacsen /lisp/play/dunnet.el

git clone https://bitbucket.org/rev22/progressive-gc-emacsen.git

Language

Lisp

MD5 Hash

d4bff540dca11f224b9bb75203b3f349

Lines in File 3360
Blank Lines 295 (8.78%)
Comment Lines 122 (4%)
Code Lines 2942 (88%)
Estimated Development Effort (Months)7.45
Estimated Development Effort (Years)1
Estimated Developers1.39
Estimated Cost$83891.00
Generated using David A. Wheeler's 'SLOCCount'.
  1. ;;; dunnet.el --- text adventure for Emacs -*- byte-compile-warnings: nil -*-
  2.  
  3. ;; Copyright (C) 1992-1993, 2001-2012 Free Software Foundation, Inc.
  4.  
  5. ;; Author: Ron Schnell <ronnie@driver-aces.com>
  6. ;; Created: 25 Jul 1992
  7. ;; Version: 2.01
  8. ;; Keywords: games
  9.  
  10. ;; This file is part of GNU Emacs.
  11.  
  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.
  16.  
  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.
  21.  
  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/>.
  24.  
  25. ;;; Commentary:
  26.  
  27. ;; This game can be run in batch mode. To do this, use:
  28. ;; emacs -batch -l dunnet
  29.  
  30. ;;; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  31. ;;; The log file should be set for your system, and it must
  32. ;;; be writable by all.
  33.  
  34. ;;; Code:
  35.  
  36. (defgroup dunnet nil
  37. "Text adventure for Emacs."
  38. :prefix "dun-"
  39. :group 'games)
  40.  
  41. (defcustom dun-log-file "/usr/local/dunnet.score"
  42. "Name of file to store score information for dunnet."
  43. :type 'file
  44. :group 'dunnet)
  45.  
  46. ;;;; Mode definitions for interactive mode
  47.  
  48. (define-derived-mode dun-mode text-mode "Dungeon"
  49. "Major mode for running dunnet."
  50. (make-local-variable 'scroll-step)
  51. (setq scroll-step 2))
  52.  
  53. (defun dun-parse (arg)
  54. "Function called when return is pressed in interactive mode to parse line."
  55. (interactive "*p")
  56. (beginning-of-line)
  57. (let ((beg (1+ (point)))
  58. line)
  59. (end-of-line)
  60. (if (and (not (= beg (point))) (not (< (point) beg))
  61. (string= ">" (buffer-substring (- beg 1) beg)))
  62. (progn
  63. (setq line (downcase (buffer-substring beg (point))))
  64. (princ line)
  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))
  68. (dun-mprinc "\n")))
  69. (dun-messages))
  70.  
  71. (defun dun-messages ()
  72. (if dun-dead
  73. (text-mode)
  74. (if (eq dungeon-mode 'dungeon)
  75. (progn
  76. (if (not (= room dun-current-room))
  77. (progn
  78. (dun-describe-room dun-current-room)
  79. (setq room dun-current-room)))
  80. (dun-fix-screen)
  81. (dun-mprinc ">")))))
  82.  
  83. ;;;###autoload
  84. (defun dunnet ()
  85. "Switch to *dungeon* buffer and start game."
  86. (interactive)
  87. (switch-to-buffer "*dungeon*")
  88. (dun-mode)
  89. (setq dun-dead nil)
  90. (setq room 0)
  91. (dun-messages))
  92.  
  93. ;;;;
  94. ;;;; This section contains all of the verbs and commands.
  95. ;;;;
  96.  
  97. ;;; Give long description of room if haven't been there yet. Otherwise
  98. ;;; short. Also give long if we were called with negative room number.
  99.  
  100. (defun dun-describe-room (room)
  101. (if (and (not (member (abs room) dun-light-rooms))
  102. (not (member obj-lamp dun-inventory)))
  103. (dun-mprincl "It is pitch dark. You are likely to be eaten by a grue.")
  104. (dun-mprincl (cadr (nth (abs room) dun-rooms)))
  105. (if (and (and (or (member room dun-visited)
  106. (string= dun-mode "dun-superb")) (> room 0))
  107. (not (string= dun-mode "long")))
  108. nil
  109. (dun-mprinc (car (nth (abs room) dun-rooms)))
  110. (dun-mprinc "\n"))
  111. (if (not (string= dun-mode "long"))
  112. (if (not (member (abs room) dun-visited))
  113. (setq dun-visited (append (list (abs room)) dun-visited))))
  114. (dolist (xobjs (nth dun-current-room dun-room-objects))
  115. (if (= xobjs obj-special)
  116. (dun-special-object)
  117. (if (>= xobjs 0)
  118. (dun-mprincl (car (nth xobjs dun-objects)))
  119. (if (not (and (= xobjs obj-bus) dun-inbus))
  120. (progn
  121. (dun-mprincl (car (nth (abs xobjs) dun-perm-objects)))))))
  122. (if (and (= xobjs obj-jar) dun-jar)
  123. (progn
  124. (dun-mprincl "The jar contains:")
  125. (dolist (x dun-jar)
  126. (dun-mprinc " ")
  127. (dun-mprincl (car (nth x dun-objects)))))))
  128. (if (and (member obj-bus (nth dun-current-room dun-room-objects)) dun-inbus)
  129. (dun-mprincl "You are on the bus."))))
  130.  
  131. ;;; There is a special object in the room. This object's description,
  132. ;;; or lack thereof, depends on certain conditions.
  133.  
  134. (defun dun-special-object ()
  135. (if (= dun-current-room computer-room)
  136. (if dun-computer
  137. (dun-mprincl
  138. "The panel lights are flashing in a seemingly organized pattern.")
  139. (dun-mprincl "The panel lights are steady and motionless.")))
  140.  
  141. (if (and (= dun-current-room red-room)
  142. (not (member obj-towel (nth red-room dun-room-objects))))
  143. (dun-mprincl "There is a hole in the floor here."))
  144.  
  145. (if (and (= dun-current-room marine-life-area) dun-black)
  146. (dun-mprincl
  147. "The room is lit by a black light, causing the fish, and some of
  148. your objects, to give off an eerie glow."))
  149. (if (and (= dun-current-room fourth-vermont-intersection) dun-hole)
  150. (progn
  151. (if (not dun-inbus)
  152. (progn
  153. (dun-mprincl"You fall into a hole in the ground.")
  154. (setq dun-current-room vermont-station)
  155. (dun-describe-room vermont-station))
  156. (progn
  157. (dun-mprincl
  158. "The bus falls down a hole in the ground and explodes.")
  159. (dun-die "burning")))))
  160.  
  161. (if (> dun-current-room endgame-computer-room)
  162. (progn
  163. (if (not dun-correct-answer)
  164. (dun-endgame-question)
  165. (dun-mprincl "Your question is:")
  166. (dun-mprincl dun-endgame-question))))
  167.  
  168. (if (= dun-current-room sauna)
  169. (progn
  170. (dun-mprincl (nth dun-sauna-level '(
  171. "It is normal room temperature in here."
  172. "It is luke warm in here."
  173. "It is comfortably hot in here."
  174. "It is refreshingly hot in here."
  175. "You are dead now.")))
  176. (if (= dun-sauna-level 3)
  177. (progn
  178. (if (or (member obj-rms dun-inventory)
  179. (member obj-rms (nth dun-current-room dun-room-objects)))
  180. (progn
  181. (dun-mprincl
  182. "You notice the wax on your statuette beginning to melt, until it completely
  183. melts off. You are left with a beautiful diamond!")
  184. (if (member obj-rms dun-inventory)
  185. (progn
  186. (dun-remove-obj-from-inven obj-rms)
  187. (setq dun-inventory (append dun-inventory
  188. (list obj-diamond))))
  189. (dun-remove-obj-from-room dun-current-room obj-rms)
  190. (dun-replace dun-room-objects dun-current-room
  191. (append (nth dun-current-room dun-room-objects)
  192. (list obj-diamond))))))
  193. (if (or (member obj-floppy dun-inventory)
  194. (member obj-floppy (nth dun-current-room dun-room-objects)))
  195. (progn
  196. (dun-mprincl
  197. "You notice your floppy disk beginning to melt. As you grab for it, the
  198. disk bursts into flames, and disintegrates.")
  199. (dun-remove-obj-from-inven obj-floppy)
  200. (dun-remove-obj-from-room dun-current-room obj-floppy))))))))
  201.  
  202.  
  203. (defun dun-die (murderer)
  204. (dun-mprinc "\n")
  205. (if murderer
  206. (dun-mprincl "You are dead."))
  207. (dun-do-logfile 'dun-die murderer)
  208. (dun-score nil)
  209. (setq dun-dead t))
  210.  
  211. (defun dun-quit (args)
  212. (dun-die nil))
  213.  
  214. ;;; Print every object in player's inventory. Special case for the jar,
  215. ;;; as we must also print what is in it.
  216.  
  217. (defun dun-inven (args)
  218. (dun-mprinc "You currently have:")
  219. (dun-mprinc "\n")
  220. (dolist (curobj dun-inventory)
  221. (if curobj
  222. (progn
  223. (dun-mprincl (cadr (nth curobj dun-objects)))
  224. (if (and (= curobj obj-jar) dun-jar)
  225. (progn
  226. (dun-mprincl "The jar contains:")
  227. (dolist (x dun-jar)
  228. (dun-mprinc " ")
  229. (dun-mprincl (cadr (nth x dun-objects))))))))))
  230.  
  231. (defun dun-shake (obj)
  232. (let (objnum)
  233. (when (setq objnum (dun-objnum-from-args-std obj))
  234. (if (member objnum dun-inventory)
  235. (progn
  236. ;;; If shaking anything will do anything, put here.
  237. (dun-mprinc "Shaking ")
  238. (dun-mprinc (downcase (cadr (nth objnum dun-objects))))
  239. (dun-mprinc " seems to have no effect.")
  240. (dun-mprinc "\n")
  241. )
  242. (if (and (not (member objnum (nth dun-current-room dun-room-silents)))
  243. (not (member objnum (nth dun-current-room dun-room-objects))))
  244. (dun-mprincl "I don't see that here.")
  245. ;;; Shaking trees can be deadly
  246. (if (= objnum obj-tree)
  247. (progn
  248. (dun-mprinc
  249. "You begin to shake a tree, and notice a coconut begin to fall from the air.
  250. As you try to get your hand up to block it, you feel the impact as it lands
  251. on your head.")
  252. (dun-die "a coconut"))
  253. (if (= objnum obj-bear)
  254. (progn
  255. (dun-mprinc
  256. "As you go up to the bear, it removes your head and places it on the ground.")
  257. (dun-die "a bear"))
  258. (if (< objnum 0)
  259. (dun-mprincl "You cannot shake that.")
  260. (dun-mprincl "You don't have that.")))))))))
  261.  
  262.  
  263. (defun dun-drop (obj)
  264. (if dun-inbus
  265. (dun-mprincl "You can't drop anything while on the bus.")
  266. (let (objnum ptr)
  267. (when (setq objnum (dun-objnum-from-args-std obj))
  268. (if (not (setq ptr (member objnum dun-inventory)))
  269. (dun-mprincl "You don't have that.")
  270. (progn
  271. (dun-remove-obj-from-inven objnum)
  272. (dun-replace dun-room-objects dun-current-room
  273. (append (nth dun-current-room dun-room-objects)
  274. (list objnum)))
  275. (dun-mprincl "Done.")
  276. (if (member objnum (list obj-food obj-weight obj-jar))
  277. (dun-drop-check objnum))))))))
  278.  
  279. ;;; Dropping certain things causes things to happen.
  280.  
  281. (defun dun-drop-check (objnum)
  282. (if (and (= objnum obj-food) (= room bear-hangout)
  283. (member obj-bear (nth bear-hangout dun-room-objects)))
  284. (progn
  285. (dun-mprincl
  286. "The bear takes the food and runs away with it. He left something behind.")
  287. (dun-remove-obj-from-room dun-current-room obj-bear)
  288. (dun-remove-obj-from-room dun-current-room obj-food)
  289. (dun-replace dun-room-objects dun-current-room
  290. (append (nth dun-current-room dun-room-objects)
  291. (list obj-key)))))
  292.  
  293. (if (and (= objnum obj-jar) (member obj-nitric dun-jar)
  294. (member obj-glycerine dun-jar))
  295. (progn
  296. (dun-mprincl
  297. "As the jar impacts the ground it explodes into many pieces.")
  298. (setq dun-jar nil)
  299. (dun-remove-obj-from-room dun-current-room obj-jar)
  300. (if (= dun-current-room fourth-vermont-intersection)
  301. (progn
  302. (setq dun-hole t)
  303. (setq dun-current-room vermont-station)
  304. (dun-mprincl
  305. "The explosion causes a hole to open up in the ground, which you fall
  306. through.")))))
  307.  
  308. (if (and (= objnum obj-weight) (= dun-current-room maze-button-room))
  309. (dun-mprincl "A passageway opens.")))
  310.  
  311. ;;; Give long description of current room, or an object.
  312.  
  313. (defun dun-examine (obj)
  314. (let (objnum)
  315. (setq objnum (dun-objnum-from-args obj))
  316. (if (eq objnum obj-special)
  317. (dun-describe-room (* dun-current-room -1))
  318. (if (and (eq objnum obj-computer)
  319. (member obj-pc (nth dun-current-room dun-room-silents)))
  320. (dun-examine '("pc"))
  321. (if (eq objnum nil)
  322. (dun-mprincl "I don't know what that is.")
  323. (if (and (not (member objnum
  324. (nth dun-current-room dun-room-objects)))
  325. (not (and (member obj-jar dun-inventory)
  326. (member objnum dun-jar)))
  327. (not (member objnum
  328. (nth dun-current-room dun-room-silents)))
  329. (not (member objnum dun-inventory)))
  330. (dun-mprincl "I don't see that here.")
  331. (if (>= objnum 0)
  332. (if (and (= objnum obj-bone)
  333. (= dun-current-room marine-life-area) dun-black)
  334. (dun-mprincl
  335. "In this light you can see some writing on the bone. It says:
  336. For an explosive time, go to Fourth St. and Vermont.")
  337. (if (nth objnum dun-physobj-desc)
  338. (dun-mprincl (nth objnum dun-physobj-desc))
  339. (dun-mprincl "I see nothing special about that.")))
  340. (if (nth (abs objnum) dun-permobj-desc)
  341. (progn
  342. (dun-mprincl (nth (abs objnum) dun-permobj-desc)))
  343. (dun-mprincl "I see nothing special about that.")))))))))
  344.  
  345. (defun dun-take (obj)
  346. (setq obj (dun-firstword obj))
  347. (if (not obj)
  348. (dun-mprincl "You must supply an object.")
  349. (if (string= obj "all")
  350. (let (gotsome)
  351. (if dun-inbus
  352. (dun-mprincl "You can't take anything while on the bus.")
  353. (setq gotsome nil)
  354. (dolist (x (nth dun-current-room dun-room-objects))
  355. (if (and (>= x 0) (not (= x obj-special)))
  356. (progn
  357. (setq gotsome t)
  358. (dun-mprinc (cadr (nth x dun-objects)))
  359. (dun-mprinc ": ")
  360. (dun-take-object x))))
  361. (if (not gotsome)
  362. (dun-mprincl "Nothing to take."))))
  363. (let (objnum)
  364. (setq objnum (cdr (assq (intern obj) dun-objnames)))
  365. (if (eq objnum nil)
  366. (progn
  367. (dun-mprinc "I don't know what that is.")
  368. (dun-mprinc "\n"))
  369. (if (and dun-inbus (not (and (member objnum dun-jar)
  370. (member obj-jar dun-inventory))))
  371. (dun-mprincl "You can't take anything while on the bus.")
  372. (dun-take-object objnum)))))))
  373.  
  374. (defun dun-take-object (objnum)
  375. (if (and (member objnum dun-jar) (member obj-jar dun-inventory))
  376. (let (newjar)
  377. (dun-mprincl "You remove it from the jar.")
  378. (setq newjar nil)
  379. (dolist (x dun-jar)
  380. (if (not (= x objnum))
  381. (setq newjar (append newjar (list x)))))
  382. (setq dun-jar newjar)
  383. (setq dun-inventory (append dun-inventory (list objnum))))
  384. (if (not (member objnum (nth dun-current-room dun-room-objects)))
  385. (if (not (member objnum (nth dun-current-room dun-room-silents)))
  386. (dun-mprinc "I do not see that here.")
  387. (dun-try-take objnum))
  388. (if (>= objnum 0)
  389. (progn
  390. (if (and (car dun-inventory)
  391. (> (+ (dun-inven-weight) (nth objnum dun-object-lbs)) 11))
  392. (dun-mprinc "Your load would be too heavy.")
  393. (setq dun-inventory (append dun-inventory (list objnum)))
  394. (dun-remove-obj-from-room dun-current-room objnum)
  395. (dun-mprinc "Taken. ")
  396. (if (and (= objnum obj-towel) (= dun-current-room red-room))
  397. (dun-mprinc
  398. "Taking the towel reveals a hole in the floor."))))
  399. (dun-try-take objnum)))
  400. (dun-mprinc "\n")))
  401.  
  402. (defun dun-inven-weight ()
  403. (let (total)
  404. (setq total 0)
  405. (dolist (x dun-jar)
  406. (setq total (+ total (nth x dun-object-lbs))))
  407. (dolist (x dun-inventory)
  408. (setq total (+ total (nth x dun-object-lbs)))) total))
  409.  
  410. ;;; We try to take an object that is untakable. Print a message
  411. ;;; depending on what it is.
  412.  
  413. (defun dun-try-take (obj)
  414. (dun-mprinc "You cannot take that."))
  415.  
  416. (defun dun-dig (args)
  417. (if dun-inbus
  418. (dun-mprincl "Digging here reveals nothing.")
  419. (if (not (member 0 dun-inventory))
  420. (dun-mprincl "You have nothing with which to dig.")
  421. (if (not (nth dun-current-room dun-diggables))
  422. (dun-mprincl "Digging here reveals nothing.")
  423. (dun-mprincl "I think you found something.")
  424. (dun-replace dun-room-objects dun-current-room
  425. (append (nth dun-current-room dun-room-objects)
  426. (nth dun-current-room dun-diggables)))
  427. (dun-replace dun-diggables dun-current-room nil)))))
  428.  
  429. (defun dun-climb (obj)
  430. (let (objnum)
  431. (setq objnum (dun-objnum-from-args obj))
  432. (cond ((not objnum)
  433. (dun-mprincl "I don't know what that object is."))
  434. ((and (not (eq objnum obj-special))
  435. (not (member objnum (nth dun-current-room dun-room-objects)))
  436. (not (member objnum (nth dun-current-room dun-room-silents)))
  437. (not (and (member objnum dun-jar) (member obj-jar dun-inventory)))
  438. (not (member objnum dun-inventory)))
  439. (dun-mprincl "I don't see that here."))
  440. ((and (eq objnum obj-special)
  441. (not (member obj-tree (nth dun-current-room dun-room-silents))))
  442. (dun-mprincl "There is nothing here to climb."))
  443. ((and (not (eq objnum obj-tree)) (not (eq objnum obj-special)))
  444. (dun-mprincl "You can't climb that."))
  445. (t
  446. (dun-mprincl
  447. "You manage to get about two feet up the tree and fall back down. You
  448. notice that the tree is very unsteady.")))))
  449.  
  450. (defun dun-eat (obj)
  451. (let (objnum)
  452. (when (setq objnum (dun-objnum-from-args-std obj))
  453. (if (not (member objnum dun-inventory))
  454. (dun-mprincl "You don't have that.")
  455. (if (not (= objnum obj-food))
  456. (progn
  457. (dun-mprinc "You forcefully shove ")
  458. (dun-mprinc (downcase (cadr (nth objnum dun-objects))))
  459. (dun-mprincl " down your throat, and start choking.")
  460. (dun-die "choking"))
  461. (dun-mprincl "That tasted horrible.")
  462. (dun-remove-obj-from-inven obj-food))))))
  463.  
  464. (defun dun-put (args)
  465. (let (newargs objnum objnum2 obj)
  466. (setq newargs (dun-firstwordl args))
  467. (if (not newargs)
  468. (dun-mprincl "You must supply an object")
  469. (setq obj (intern (car newargs)))
  470. (setq objnum (cdr (assq obj dun-objnames)))
  471. (if (not objnum)
  472. (dun-mprincl "I don't know what that object is.")
  473. (if (not (member objnum dun-inventory))
  474. (dun-mprincl "You don't have that.")
  475. (setq newargs (dun-firstwordl (cdr newargs)))
  476. (setq newargs (dun-firstwordl (cdr newargs)))
  477. (if (not newargs)
  478. (dun-mprincl "You must supply an indirect object.")
  479. (setq objnum2 (cdr (assq (intern (car newargs)) dun-objnames)))
  480. (if (and (eq objnum2 obj-computer) (= dun-current-room pc-area))
  481. (setq objnum2 obj-pc))
  482. (if (not objnum2)
  483. (dun-mprincl "I don't know what that indirect object is.")
  484. (if (and (not (member objnum2
  485. (nth dun-current-room dun-room-objects)))
  486. (not (member objnum2
  487. (nth dun-current-room dun-room-silents)))
  488. (not (member objnum2 dun-inventory)))
  489. (dun-mprincl "That indirect object is not here.")
  490. (dun-put-objs objnum objnum2)))))))))
  491.  
  492. (defun dun-put-objs (obj1 obj2)
  493. (if (and (= obj2 obj-drop) (not dun-nomail))
  494. (setq obj2 obj-chute))
  495.  
  496. (if (= obj2 obj-disposal) (setq obj2 obj-chute))
  497.  
  498. (if (and (= obj1 obj-cpu) (= obj2 obj-computer))
  499. (progn
  500. (dun-remove-obj-from-inven obj-cpu)
  501. (setq dun-computer t)
  502. (dun-mprincl
  503. "As you put the CPU board in the computer, it immediately springs to life.
  504. The lights start flashing, and the fans seem to startup."))
  505. (if (and (= obj1 obj-weight) (= obj2 obj-button))
  506. (dun-drop '("weight"))
  507. (if (= obj2 obj-jar) ;; Put something in jar
  508. (if (not (member obj1 (list obj-paper obj-diamond obj-emerald
  509. obj-license obj-coins obj-egg
  510. obj-nitric obj-glycerine)))
  511. (dun-mprincl "That will not fit in the jar.")
  512. (dun-remove-obj-from-inven obj1)
  513. (setq dun-jar (append dun-jar (list obj1)))
  514. (dun-mprincl "Done."))
  515. (if (= obj2 obj-chute) ;; Put something in chute
  516. (progn
  517. (dun-remove-obj-from-inven obj1)
  518. (dun-mprincl
  519. "You hear it slide down the chute and off into the distance.")
  520. (dun-put-objs-in-treas (list obj1)))
  521. (if (= obj2 obj-box) ;; Put key in key box
  522. (if (= obj1 obj-key)
  523. (progn
  524. (dun-mprincl
  525. "As you drop the key, the box begins to shake. Finally it explodes
  526. with a bang. The key seems to have vanished!")
  527. (dun-remove-obj-from-inven obj1)
  528. (dun-replace dun-room-objects computer-room (append
  529. (nth computer-room
  530. dun-room-objects)
  531. (list obj1)))
  532. (dun-remove-obj-from-room dun-current-room obj-box)
  533. (setq dun-key-level (1+ dun-key-level)))
  534. (dun-mprincl "You can't put that in the key box!"))
  535.  
  536. (if (and (= obj1 obj-floppy) (= obj2 obj-pc))
  537. (progn
  538. (setq dun-floppy t)
  539. (dun-remove-obj-from-inven obj1)
  540. (dun-mprincl "Done."))
  541.  
  542. (if (= obj2 obj-urinal) ;; Put object in urinal
  543. (progn
  544. (dun-remove-obj-from-inven obj1)
  545. (dun-replace dun-room-objects urinal (append
  546. (nth urinal dun-room-objects)
  547. (list obj1)))
  548. (dun-mprincl
  549. "You hear it plop down in some water below."))
  550. (if (= obj2 obj-mail)
  551. (dun-mprincl "The mail chute is locked.")
  552. (if (member obj1 dun-inventory)
  553. (dun-mprincl
  554. "I don't know how to combine those objects. Perhaps you should
  555. just try dropping it.")
  556. (dun-mprincl"You can't put that there.")))))))))))
  557.  
  558. (defun dun-type (args)
  559. (if (not (= dun-current-room computer-room))
  560. (dun-mprincl "There is nothing here on which you could type.")
  561. (if (not dun-computer)
  562. (dun-mprincl
  563. "You type on the keyboard, but your characters do not even echo.")
  564. (dun-unix-interface))))
  565.  
  566. ;;; Various movement directions
  567.  
  568. (defun dun-n (args)
  569. (dun-move north))
  570.  
  571. (defun dun-s (args)
  572. (dun-move south))
  573.  
  574. (defun dun-e (args)
  575. (dun-move east))
  576.  
  577. (defun dun-w (args)
  578. (dun-move west))
  579.  
  580. (defun dun-ne (args)
  581. (dun-move northeast))
  582.  
  583. (defun dun-se (args)
  584. (dun-move southeast))
  585.  
  586. (defun dun-nw (args)
  587. (dun-move northwest))
  588.  
  589. (defun dun-sw (args)
  590. (dun-move southwest))
  591.  
  592. (defun dun-up (args)
  593. (dun-move up))
  594.  
  595. (defun dun-down (args)
  596. (dun-move down))
  597.  
  598. (defun dun-in (args)
  599. (dun-move in))
  600.  
  601. (defun dun-out (args)
  602. (dun-move out))
  603.  
  604. (defun dun-go (args)
  605. (if (or (not (car args))
  606. (eq (dun-doverb dun-ignore dun-verblist (car args)
  607. (cdr (cdr args))) -1))
  608. (dun-mprinc "I don't understand where you want me to go.\n")))
  609.  
  610. ;;; Uses the dungeon-map to figure out where we are going. If the
  611. ;;; requested direction yields 255, we know something special is
  612. ;;; supposed to happen, or perhaps you can't go that way unless
  613. ;;; certain conditions are met.
  614.  
  615. (defun dun-move (dir)
  616. (if (and (not (member dun-current-room dun-light-rooms))
  617. (not (member obj-lamp dun-inventory)))
  618. (progn
  619. (dun-mprinc
  620. "You trip over a grue and fall into a pit and break every bone in your
  621. body.")
  622. (dun-die "a grue"))
  623. (let (newroom)
  624. (setq newroom (nth dir (nth dun-current-room dungeon-map)))
  625. (if (eq newroom -1)
  626. (dun-mprinc "You can't go that way.\n")
  627. (if (eq newroom 255)
  628. (dun-special-move dir)
  629. (setq room -1)
  630. (setq dun-lastdir dir)
  631. (if dun-inbus
  632. (progn
  633. (if (or (< newroom 58) (> newroom 83))
  634. (dun-mprincl "The bus cannot go this way.")
  635. (dun-mprincl
  636. "The bus lurches ahead and comes to a screeching halt.")
  637. (dun-remove-obj-from-room dun-current-room obj-bus)
  638. (setq dun-current-room newroom)
  639. (dun-replace dun-room-objects newroom
  640. (append (nth newroom dun-room-objects)
  641. (list obj-bus)))))
  642. (setq dun-current-room newroom)))))))
  643.  
  644. ;;; Movement in this direction causes something special to happen if the
  645. ;;; right conditions exist. It may be that you can't go this way unless
  646. ;;; you have a key, or a passage has been opened.
  647.  
  648. ;;; coding note: Each check of the current room is on the same 'if' level,
  649. ;;; i.e. there aren't else's. If two rooms next to each other have
  650. ;;; specials, and they are connected by specials, this could cause
  651. ;;; a problem. Be careful when adding them to consider this, and
  652. ;;; perhaps use else's.
  653.  
  654. (defun dun-special-move (dir)
  655. (if (= dun-current-room building-front)
  656. (if (not (member obj-key dun-inventory))
  657. (dun-mprincl "You don't have a key that can open this door.")
  658. (setq dun-current-room old-building-hallway))
  659. (if (= dun-current-room north-end-of-cave-passage)
  660. (let (combo)
  661. (dun-mprincl
  662. "You must type a 3 digit combination code to enter this room.")
  663. (dun-mprinc "Enter it here: ")
  664. (setq combo (dun-read-line))
  665. (if (not dun-batch-mode)
  666. (dun-mprinc "\n"))
  667. (if (string= combo dun-combination)
  668. (setq dun-current-room gamma-computing-center)
  669. (dun-mprincl "Sorry, that combination is incorrect."))))
  670.  
  671. (if (= dun-current-room bear-hangout)
  672. (if (member obj-bear (nth bear-hangout dun-room-objects))
  673. (progn
  674. (dun-mprinc
  675. "The bear is very annoyed that you would be so presumptuous as to try
  676. and walk right by it. He tells you so by tearing your head off.
  677. ")
  678. (dun-die "a bear"))
  679. (dun-mprincl "You can't go that way.")))
  680.  
  681. (if (= dun-current-room vermont-station)
  682. (progn
  683. (dun-mprincl
  684. "As you board the train it immediately leaves the station. It is a very
  685. bumpy ride. It is shaking from side to side, and up and down. You
  686. sit down in one of the chairs in order to be more comfortable.")
  687. (dun-mprincl
  688. "\nFinally the train comes to a sudden stop, and the doors open, and some
  689. force throws you out. The train speeds away.\n")
  690. (setq dun-current-room museum-station)))
  691.  
  692. (if (= dun-current-room old-building-hallway)
  693. (if (and (member obj-key dun-inventory)
  694. (> dun-key-level 0))
  695. (setq dun-current-room meadow)
  696. (dun-mprincl "You don't have a key that can open this door.")))
  697.  
  698. (if (and (= dun-current-room maze-button-room) (= dir northwest))
  699. (if (member obj-weight (nth maze-button-room dun-room-objects))
  700. (setq dun-current-room 18)
  701. (dun-mprincl "You can't go that way.")))
  702.  
  703. (if (and (= dun-current-room maze-button-room) (= dir up))
  704. (if (member obj-weight (nth maze-button-room dun-room-objects))
  705. (dun-mprincl "You can't go that way.")
  706. (setq dun-current-room weight-room)))
  707.  
  708. (if (= dun-current-room classroom)
  709. (dun-mprincl "The door is locked."))
  710.  
  711. (if (or (= dun-current-room lakefront-north)
  712. (= dun-current-room lakefront-south))
  713. (dun-swim nil))
  714.  
  715. (if (= dun-current-room reception-area)
  716. (if (not (= dun-sauna-level 3))
  717. (setq dun-current-room health-club-front)
  718. (dun-mprincl
  719. "As you exit the building, you notice some flames coming out of one of the
  720. windows. Suddenly, the building explodes in a huge ball of fire. The flames
  721. engulf you, and you burn to death.")
  722. (dun-die "burning")))
  723.  
  724. (if (= dun-current-room red-room)
  725. (if (not (member obj-towel (nth red-room dun-room-objects)))
  726. (setq dun-current-room long-n-s-hallway)
  727. (dun-mprincl "You can't go that way.")))
  728.  
  729. (if (and (> dir down) (> dun-current-room gamma-computing-center)
  730. (< dun-current-room museum-lobby))
  731. (if (not (member obj-bus (nth dun-current-room dun-room-objects)))
  732. (dun-mprincl "You can't go that way.")
  733. (if (= dir in)
  734. (if dun-inbus
  735. (dun-mprincl
  736. "You are already in the bus!")
  737. (if (member obj-license dun-inventory)
  738. (progn
  739. (dun-mprincl
  740. "You board the bus and get in the driver's seat.")
  741. (setq dun-nomail t)
  742. (setq dun-inbus t))
  743. (dun-mprincl "You are not licensed for this type of vehicle.")))
  744. (if (not dun-inbus)
  745. (dun-mprincl "You are already off the bus!")
  746. (dun-mprincl "You hop off the bus.")
  747. (setq dun-inbus nil))))
  748. (if (= dun-current-room fifth-oaktree-intersection)
  749. (if (not dun-inbus)
  750. (progn
  751. (dun-mprincl "You fall down the cliff and land on your head.")
  752. (dun-die "a cliff"))
  753. (dun-mprincl
  754. "The bus flies off the cliff, and plunges to the bottom, where it explodes.")
  755. (dun-die "a bus accident")))
  756. (if (= dun-current-room main-maple-intersection)
  757. (progn
  758. (if (not dun-inbus)
  759. (dun-mprincl "The gate will not open.")
  760. (dun-mprincl
  761. "As the bus approaches, the gate opens and you drive through.")
  762. (dun-remove-obj-from-room main-maple-intersection obj-bus)
  763. (dun-replace dun-room-objects museum-entrance
  764. (append (nth museum-entrance dun-room-objects)
  765. (list obj-bus)))
  766. (setq dun-current-room museum-entrance)))))
  767. (if (= dun-current-room cave-entrance)
  768. (progn
  769. (dun-mprincl
  770. "As you enter the room you hear a rumbling noise. You look back to see
  771. huge rocks sliding down from the ceiling, and blocking your way out.\n")
  772. (setq dun-current-room misty-room)))))
  773.  
  774. (defun dun-long (args)
  775. (setq dun-mode "long"))
  776.  
  777. (defun dun-turn (obj)
  778. (let (objnum direction)
  779. (when (setq objnum (dun-objnum-from-args-std obj))
  780. (if (not (or (member objnum (nth dun-current-room dun-room-objects))
  781. (member objnum (nth dun-current-room dun-room-silents))))
  782. (dun-mprincl "I don't see that here.")
  783. (if (not (= objnum obj-dial))
  784. (dun-mprincl "You can't turn that.")
  785. (setq direction (dun-firstword (cdr obj)))
  786. (if (or (not direction)
  787. (not (or (string= direction "clockwise")
  788. (string= direction "counterclockwise"))))
  789. (dun-mprincl "You must indicate clockwise or counterclockwise.")
  790. (if (string= direction "clockwise")
  791. (setq dun-sauna-level (+ dun-sauna-level 1))
  792. (setq dun-sauna-level (- dun-sauna-level 1)))
  793.  
  794. (if (< dun-sauna-level 0)
  795. (progn
  796. (dun-mprincl
  797. "The dial will not turn further in that direction.")
  798. (setq dun-sauna-level 0))
  799. (dun-sauna-heat))))))))
  800.  
  801. (defun dun-sauna-heat ()
  802. (if (= dun-sauna-level 0)
  803. (dun-mprincl
  804. "The temperature has returned to normal room temperature."))
  805. (if (= dun-sauna-level 1)
  806. (dun-mprincl "It is now luke warm in here. You are perspiring."))
  807. (if (= dun-sauna-level 2)
  808. (dun-mprincl "It is pretty hot in here. It is still very comfortable."))
  809. (if (= dun-sauna-level 3)
  810. (progn
  811. (dun-mprincl
  812. "It is now very hot. There is something very refreshing about this.")
  813. (if (or (member obj-rms dun-inventory)
  814. (member obj-rms (nth dun-current-room dun-room-objects)))
  815. (progn
  816. (dun-mprincl
  817. "You notice the wax on your statuette beginning to melt, until it completely
  818. melts off. You are left with a beautiful diamond!")
  819. (if (member obj-rms dun-inventory)
  820. (progn
  821. (dun-remove-obj-from-inven obj-rms)
  822. (setq dun-inventory (append dun-inventory
  823. (list obj-diamond))))
  824. (dun-remove-obj-from-room dun-current-room obj-rms)
  825. (dun-replace dun-room-objects dun-current-room
  826. (append (nth dun-current-room dun-room-objects)
  827. (list obj-diamond))))))
  828. (if (or (member obj-floppy dun-inventory)
  829. (member obj-floppy (nth dun-current-room dun-room-objects)))
  830. (progn
  831. (dun-mprincl
  832. "You notice your floppy disk beginning to melt. As you grab for it, the
  833. disk bursts into flames, and disintegrates.")
  834. (if (member obj-floppy dun-inventory)
  835. (dun-remove-obj-from-inven obj-floppy)
  836. (dun-remove-obj-from-room dun-current-room obj-floppy))))))
  837.  
  838. (if (= dun-sauna-level 4)
  839. (progn
  840. (dun-mprincl
  841. "As the dial clicks into place, you immediately burst into flames.")
  842. (dun-die "burning"))))
  843.  
  844. (defun dun-press (obj)
  845. (let (objnum)
  846. (when (setq objnum (dun-objnum-from-args-std obj))
  847. (if (not (or (member objnum (nth dun-current-room dun-room-objects))
  848. (member objnum (nth dun-current-room dun-room-silents))))
  849. (dun-mprincl "I don't see that here.")
  850. (if (not (member objnum (list obj-button obj-switch)))
  851. (progn
  852. (dun-mprinc "You can't ")
  853. (dun-mprinc (car line-list))
  854. (dun-mprincl " that."))
  855. (if (= objnum obj-button)
  856. (dun-mprincl
  857. "As you press the button, you notice a passageway open up, but
  858. as you release it, the passageway closes."))
  859. (if (= objnum obj-switch)
  860. (if dun-black
  861. (progn
  862. (dun-mprincl "The button is now in the off position.")
  863. (setq dun-black nil))
  864. (dun-mprincl "The button is now in the on position.")
  865. (setq dun-black t))))))))
  866.  
  867. (defun dun-swim (args)
  868. (if (not (member dun-current-room (list lakefront-north lakefront-south)))
  869. (dun-mprincl "I see no water!")
  870. (if (not (member obj-life dun-inventory))
  871. (progn
  872. (dun-mprincl
  873. "You dive in the water, and at first notice it is quite cold. You then
  874. start to get used to it as you realize that you never really learned how
  875. to swim.")
  876. (dun-die "drowning"))
  877. (if (= dun-current-room lakefront-north)
  878. (setq dun-current-room lakefront-south)
  879. (setq dun-current-room lakefront-north)))))
  880.  
  881.  
  882. (defun dun-score (args)
  883. (if (not dun-endgame)
  884. (let (total)
  885. (setq total (dun-reg-score))
  886. (dun-mprinc "You have scored ")
  887. (dun-mprinc total)
  888. (dun-mprincl " out of a possible 90 points.") total)
  889. (dun-mprinc "You have scored ")
  890. (dun-mprinc (dun-endgame-score))
  891. (dun-mprincl " endgame points out of a possible 110.")
  892. (if (= (dun-endgame-score) 110)
  893. (dun-mprincl
  894. "\n\nCongratulations. You have won. The wizard password is 'moby'"))))
  895.  
  896. (defun dun-help (args)
  897. (dun-mprincl
  898. "Welcome to dunnet (2.01), by Ron Schnell (ronnie@driver-aces.com).
  899. Here is some useful information (read carefully because there are one
  900. or more clues in here):
  901. - If you have a key that can open a door, you do not need to explicitly
  902. open it. You may just use 'in' or walk in the direction of the door.
  903.  
  904. - If you have a lamp, it is always lit.
  905.  
  906. - You will not get any points until you manage to get treasures to a certain
  907. place. Simply finding the treasures is not good enough. There is more
  908. than one way to get a treasure to the special place. It is also
  909. important that the objects get to the special place *unharmed* and
  910. *untarnished*. You can tell if you have successfully transported the
  911. object by looking at your score, as it changes immediately. Note that
  912. an object can become harmed even after you have received points for it.
  913. If this happens, your score will decrease, and in many cases you can never
  914. get credit for it again.
  915.  
  916. - You can save your game with the 'save' command, and use restore it
  917. with the 'restore' command.
  918.  
  919. - There are no limits on lengths of object names.
  920.  
  921. - Directions are: north,south,east,west,northeast,southeast,northwest,
  922. southwest,up,down,in,out.
  923.  
  924. - These can be abbreviated: n,s,e,w,ne,se,nw,sw,u,d,in,out.
  925.  
  926. - If you go down a hole in the floor without an aid such as a ladder,
  927. you probably won't be able to get back up the way you came, if at all.
  928.  
  929. - To run this game in batch mode (no Emacs window), use:
  930. emacs -batch -l dunnet
  931. NOTE: This game *should* be run in batch mode!
  932.  
  933. If you have questions or comments, please contact ronnie@driver-aces.com
  934. My home page is http://www.driver-aces.com/ronnie.html
  935. "))
  936.  
  937. (defun dun-flush (args)
  938. (if (not (= dun-current-room bathroom))
  939. (dun-mprincl "I see nothing to flush.")
  940. (dun-mprincl "Whoooosh!!")
  941. (dun-put-objs-in-treas (nth urinal dun-room-objects))
  942. (dun-replace dun-room-objects urinal nil)))
  943.  
  944. (defun dun-piss (args)
  945. (if (not (= dun-current-room bathroom))
  946. (dun-mprincl "You can't do that here, don't even bother trying.")
  947. (if (not dun-gottago)
  948. (dun-mprincl "I'm afraid you don't have to go now.")
  949. (dun-mprincl "That was refreshing.")
  950. (setq dun-gottago nil)
  951. (dun-replace dun-room-objects urinal (append
  952. (nth urinal dun-room-objects)
  953. (list obj-URINE))))))
  954.  
  955.  
  956. (defun dun-sleep (args)
  957. (if (not (= dun-current-room bedroom))
  958. (dun-mprincl
  959. "You try to go to sleep while standing up here, but can't seem to do it.")
  960. (setq dun-gottago t)
  961. (dun-mprincl
  962. "As soon as you start to doze off you begin dreaming. You see images of
  963. workers digging caves, slaving in the humid heat. Then you see yourself
  964. as one of these workers. While no one is looking, you leave the group
  965. and walk into a room. The room is bare except for a horseshoe
  966. shaped piece of stone in the center. You see yourself digging a hole in
  967. the ground, then putting some kind of treasure in it, and filling the hole
  968. with dirt again. After this, you immediately wake up.")))
  969.  
  970. (defun dun-break (obj)
  971. (let (objnum)
  972. (if (not (member obj-axe dun-inventory))
  973. (dun-mprincl "You have nothing you can use to break things.")
  974. (when (setq objnum (dun-objnum-from-args-std obj))
  975. (if (member objnum dun-inventory)
  976. (progn
  977. (dun-mprincl
  978. "You take the object in your hands and swing the axe. Unfortunately, you miss
  979. the object and slice off your hand. You bleed to death.")
  980. (dun-die "an axe"))
  981. (if (not (or (member objnum (nth dun-current-room dun-room-objects))
  982. (member objnum
  983. (nth dun-current-room dun-room-silents))))
  984. (dun-mprincl "I don't see that here.")
  985. (if (= objnum obj-cable)
  986. (progn
  987. (dun-mprincl
  988. "As you break the ethernet cable, everything starts to blur. You collapse
  989. for a moment, then straighten yourself up.
  990. ")
  991. (dun-replace dun-room-objects gamma-computing-center
  992. (append
  993. (nth gamma-computing-center dun-room-objects)
  994. dun-inventory))
  995. (if (member obj-key dun-inventory)
  996. (progn
  997. (setq dun-inventory (list obj-key))
  998. (dun-remove-obj-from-room
  999. gamma-computing-center obj-key))
  1000. (setq dun-inventory nil))
  1001. (setq dun-current-room computer-room)
  1002. (setq dun-ethernet nil)
  1003. (dun-mprincl "Connection closed.")
  1004. (dun-unix-interface))
  1005. (if (< objnum 0)
  1006. (progn
  1007. (dun-mprincl "Your axe shatters into a million pieces.")
  1008. (dun-remove-obj-from-inven obj-axe))
  1009. (dun-mprincl "Your axe breaks it into a million pieces.")
  1010. (dun-remove-obj-from-room dun-current-room objnum)))))))))
  1011.  
  1012. (defun dun-drive (args)
  1013. (if (not dun-inbus)
  1014. (dun-mprincl "You cannot drive when you aren't in a vehicle.")
  1015. (dun-mprincl "To drive while you are in the bus, just give a direction.")))
  1016.  
  1017. (defun dun-superb (args)
  1018. (setq dun-mode 'dun-superb))
  1019.  
  1020. (defun dun-reg-score ()
  1021. (let (total)
  1022. (setq total 0)
  1023. (dolist (x (nth treasure-room dun-room-objects))
  1024. (setq total (+ total (nth x dun-object-pts))))
  1025. (if (member obj-URINE (nth treasure-room dun-room-objects))
  1026. (setq total 0)) total))
  1027.  
  1028. (defun dun-endgame-score ()
  1029. (let (total)
  1030. (setq total 0)
  1031. (dolist (x (nth endgame-treasure-room dun-room-objects))
  1032. (setq total (+ total (nth x dun-object-pts)))) total))
  1033.  
  1034. (defun dun-answer (args)
  1035. (if (not dun-correct-answer)
  1036. (dun-mprincl "I don't believe anyone asked you anything.")
  1037. (setq args (car args))
  1038. (if (not args)
  1039. (dun-mprincl "You must give the answer on the same line.")
  1040. (if (dun-members args dun-correct-answer)
  1041. (progn
  1042. (dun-mprincl "Correct.")
  1043. (if (= dun-lastdir 0)
  1044. (setq dun-current-room (1+ dun-current-room))
  1045. (setq dun-current-room (- dun-current-room 1)))
  1046. (setq dun-correct-answer nil))
  1047. (dun-mprincl "That answer is incorrect.")))))
  1048.  
  1049. (defun dun-endgame-question ()
  1050. (if (not dun-endgame-questions)
  1051. (progn
  1052. (dun-mprincl "Your question is:")
  1053. (dun-mprincl "No more questions, just do 'answer foo'.")
  1054. (setq dun-correct-answer '("foo")))
  1055. (let (which i newques)
  1056. (setq i 0)
  1057. (setq newques nil)
  1058. (setq which (random (length dun-endgame-questions)))
  1059. (dun-mprincl "Your question is:")
  1060. (dun-mprincl (setq dun-endgame-question (car
  1061. (nth which
  1062. dun-endgame-questions))))
  1063. (setq dun-correct-answer (cdr (nth which dun-endgame-questions)))
  1064. (while (< i which)
  1065. (setq newques (append newques (list (nth i dun-endgame-questions))))
  1066. (setq i (1+ i)))
  1067. (setq i (1+ which))
  1068. (while (< i (length dun-endgame-questions))
  1069. (setq newques (append newques (list (nth i dun-endgame-questions))))
  1070. (setq i (1+ i)))
  1071. (setq dun-endgame-questions newques))))
  1072.  
  1073. (defun dun-power (args)
  1074. (if (not (= dun-current-room pc-area))
  1075. (dun-mprincl "That operation is not applicable here.")
  1076. (if (not dun-floppy)
  1077. (dun-dos-no-disk)
  1078. (dun-dos-interface))))
  1079.  
  1080. (defun dun-feed (args)
  1081. (let (objnum)
  1082. (when (setq objnum (dun-objnum-from-args-std args))
  1083. (if (and (= objnum obj-bear)
  1084. (member obj-bear (nth dun-current-room dun-room-objects)))
  1085. (progn
  1086. (if (not (member obj-food dun-inventory))
  1087. (dun-mprincl "You have nothing with which to feed it.")
  1088. (dun-drop '("food"))))
  1089. (if (not (or (member objnum (nth dun-current-room dun-room-objects))
  1090. (member objnum dun-inventory)
  1091. (member objnum (nth dun-current-room dun-room-silents))))
  1092. (dun-mprincl "I don't see that here.")
  1093. (dun-mprincl "You cannot feed that."))))))
  1094.  
  1095.  
  1096. ;;;;
  1097. ;;;; This section defines various utility functions used
  1098. ;;;; by dunnet.
  1099. ;;;;
  1100.  
  1101.  
  1102. ;;; Function which takes a verb and a list of other words. Calls proper
  1103. ;;; function associated with the verb, and passes along the other words.
  1104.  
  1105. (defun dun-doverb (dun-ignore dun-verblist verb rest)
  1106. (if (not verb)
  1107. nil
  1108. (if (member (intern verb) dun-ignore)
  1109. (if (not (car rest)) -1
  1110. (dun-doverb dun-ignore dun-verblist (car rest) (cdr rest)))
  1111. (if (not (cdr (assq (intern verb) dun-verblist))) -1
  1112. (setq dun-numcmds (1+ dun-numcmds))
  1113. (eval (list (cdr (assq (intern verb) dun-verblist)) (quote rest)))))))
  1114.  
  1115.  
  1116. ;;; Function to take a string and change it into a list of lowercase words.
  1117.  
  1118. (defun dun-listify-string (strin)
  1119. (let (pos ret-list end-pos)
  1120. (setq pos 0)
  1121. (setq ret-list nil)
  1122. (while (setq end-pos (string-match "[ ,:;]" (substring strin pos)))
  1123. (setq end-pos (+ end-pos pos))
  1124. (if (not (= end-pos pos))
  1125. (setq ret-list (append ret-list (list
  1126. (downcase
  1127. (substring strin pos end-pos))))))
  1128. (setq pos (+ end-pos 1))) ret-list))
  1129.  
  1130. (defun dun-listify-string2 (strin)
  1131. (let (pos ret-list end-pos)
  1132. (setq pos 0)
  1133. (setq ret-list nil)
  1134. (while (setq end-pos (string-match " " (substring strin pos)))
  1135. (setq end-pos (+ end-pos pos))
  1136. (if (not (= end-pos pos))
  1137. (setq ret-list (append ret-list (list
  1138. (downcase
  1139. (substring strin pos end-pos))))))
  1140. (setq pos (+ end-pos 1))) ret-list))
  1141.  
  1142. (defun dun-replace (list n number)
  1143. (rplaca (nthcdr n list) number))
  1144.  
  1145.  
  1146. ;;; Get the first non-ignored word from a list.
  1147.  
  1148. (defun dun-firstword (list)
  1149. (if (not (car list))
  1150. nil
  1151. (while (and list (member (intern (car list)) dun-ignore))
  1152. (setq list (cdr list)))
  1153. (car list)))
  1154.  
  1155. (defun dun-firstwordl (list)
  1156. (if (not (car list))
  1157. nil
  1158. (while (and list (member (intern (car list)) dun-ignore))
  1159. (setq list (cdr list)))
  1160. list))
  1161.  
  1162. ;;; parse a line passed in as a string Call the proper verb with the
  1163. ;;; rest of the line passed in as a list.
  1164.  
  1165. (defun dun-vparse (dun-ignore dun-verblist line)
  1166. (dun-mprinc "\n")
  1167. (setq line-list (dun-listify-string (concat line " ")))
  1168. (dun-doverb dun-ignore dun-verblist (car line-list) (cdr line-list)))
  1169.  
  1170. (defun dun-parse2 (dun-ignore dun-verblist line)
  1171. (dun-mprinc "\n")
  1172. (setq line-list (dun-listify-string2 (concat line " ")))
  1173. (dun-doverb dun-ignore dun-verblist (car line-list) (cdr line-list)))
  1174.  
  1175. ;;; Read a line, in window mode
  1176.  
  1177. (defun dun-read-line ()
  1178. (let (line)
  1179. (setq line (read-string ""))
  1180. (dun-mprinc line) line))
  1181.  
  1182. ;;; Insert something into the window buffer
  1183.  
  1184. (defun dun-minsert (string)
  1185. (if (stringp string)
  1186. (insert string)
  1187. (insert (prin1-to-string string))))
  1188.  
  1189. ;;; Print something out, in window mode
  1190.  
  1191. (defun dun-mprinc (string)
  1192. (if (stringp string)
  1193. (insert string)
  1194. (insert (prin1-to-string string))))
  1195.  
  1196. ;;; In window mode, keep screen from jumping by keeping last line at
  1197. ;;; the bottom of the screen.
  1198.  
  1199. (defun dun-fix-screen ()
  1200. (interactive)
  1201. (forward-line (- 0 (- (window-height) 2 )))
  1202. (set-window-start (selected-window) (point))
  1203. (end-of-buffer))
  1204.  
  1205. ;;; Insert something into the buffer, followed by newline.
  1206.  
  1207. (defun dun-minsertl (string)
  1208. (dun-minsert string)
  1209. (dun-minsert "\n"))
  1210.  
  1211. ;;; Print something, followed by a newline.
  1212.  
  1213. (defun dun-mprincl (string)
  1214. (dun-mprinc string)
  1215. (dun-mprinc "\n"))
  1216.  
  1217. ;;; Function which will get an object number given the list of
  1218. ;;; words in the command, except for the verb.
  1219.  
  1220. (defun dun-objnum-from-args (obj)
  1221. (let (objnum)
  1222. (setq obj (dun-firstword obj))
  1223. (if (not obj)
  1224. obj-special
  1225. (setq objnum (cdr (assq (intern obj) dun-objnames))))))
  1226.  
  1227. (defun dun-objnum-from-args-std (obj)
  1228. (let (result)
  1229. (if (eq (setq result (dun-objnum-from-args obj)) obj-special)
  1230. (dun-mprincl "You must supply an object."))
  1231. (if (eq result nil)
  1232. (dun-mprincl "I don't know what that is."))
  1233. (if (eq result obj-special)
  1234. nil
  1235. result)))
  1236.  
  1237. ;;; Take a short room description, and change spaces and slashes to dashes.
  1238.  
  1239. (defun dun-space-to-hyphen (string)
  1240. (let (space)
  1241. (if (setq space (string-match "[ /]" string))
  1242. (progn
  1243. (setq string (concat (substring string 0 space) "-"
  1244. (substring string (1+ space))))
  1245. (dun-space-to-hyphen string))
  1246. string)))
  1247.  
  1248. ;;; Given a unix style pathname, build a list of path components (recursive)
  1249.  
  1250. (defun dun-get-path (dirstring startlist)
  1251. (let (slash pos)
  1252. (if (= (length dirstring) 0)
  1253. startlist
  1254. (if (string= (substring dirstring 0 1) "/")
  1255. (dun-get-path (substring dirstring 1) (append startlist (list "/")))
  1256. (if (not (setq slash (string-match "/" dirstring)))
  1257. (append startlist (list dirstring))
  1258. (dun-get-path (substring dirstring (1+ slash))
  1259. (append startlist
  1260. (list (substring dirstring 0 slash)))))))))
  1261.  
  1262.  
  1263. ;;; Is a string a member of a string list?
  1264.  
  1265. (defun dun-members (string string-list)
  1266. (let (found)
  1267. (setq found nil)
  1268. (dolist (x string-list)
  1269. (if (string= x string)
  1270. (setq found t))) found))
  1271.  
  1272. ;;; Function to put objects in the treasure room. Also prints current
  1273. ;;; score to let user know he has scored.
  1274.  
  1275. (defun dun-put-objs-in-treas (objlist)
  1276. (let (oscore newscore)
  1277. (setq oscore (dun-reg-score))
  1278. (dun-replace dun-room-objects 0 (append (nth 0 dun-room-objects) objlist))
  1279. (setq newscore (dun-reg-score))
  1280. (if (not (= oscore newscore))
  1281. (dun-score nil))))
  1282.  
  1283. ;;; Load an encrypted file, and eval it.
  1284.  
  1285. (defun dun-load-d (filename)
  1286. (let (old-buffer result)
  1287. (setq result t)
  1288. (setq old-buffer (current-buffer))
  1289. (switch-to-buffer (get-buffer-create "*loadc*"))
  1290. (erase-buffer)
  1291. (condition-case nil
  1292. (insert-file-contents filename)
  1293. (error (setq result nil)))
  1294. (unless (not result)
  1295. (condition-case nil
  1296. (dun-rot13)
  1297. (error (yank)))
  1298. (eval-buffer)
  1299. (kill-buffer (current-buffer)))
  1300. (switch-to-buffer old-buffer)
  1301. result))
  1302.  
  1303. ;;; Functions to remove an object either from a room, or from inventory.
  1304.  
  1305. (defun dun-remove-obj-from-room (room objnum)
  1306. (let (newroom)
  1307. (setq newroom nil)
  1308. (dolist (x (nth room dun-room-objects))
  1309. (if (not (= x objnum))
  1310. (setq newroom (append newroom (list x)))))
  1311. (rplaca (nthcdr room dun-room-objects) newroom)))
  1312.  
  1313. (defun dun-remove-obj-from-inven (objnum)
  1314. (let (new-inven)
  1315. (setq new-inven nil)
  1316. (dolist (x dun-inventory)
  1317. (if (not (= x objnum))
  1318. (setq new-inven (append new-inven (list x)))))
  1319. (setq dun-inventory new-inven)))
  1320.  
  1321.  
  1322. (let ((i 0) (lower "abcdefghijklmnopqrstuvwxyz") upper)
  1323. (setq dun-translate-table (make-vector 256 0))
  1324. (while (< i 256)
  1325. (aset dun-translate-table i i)
  1326. (setq i (1+ i)))
  1327. (setq lower (concat lower lower))
  1328. (setq upper (upcase lower))
  1329. (setq i 0)
  1330. (while (< i 26)
  1331. (aset dun-translate-table (+ ?a i) (aref lower (+ i 13)))
  1332. (aset dun-translate-table (+ ?A i) (aref upper (+ i 13)))
  1333. (setq i (1+ i))))
  1334.  
  1335. (defun dun-rot13 ()
  1336. (let (str len (i 0))
  1337. (setq str (buffer-substring (point-min) (point-max)))
  1338. (setq len (length str))
  1339. (while (< i len)
  1340. (aset str i (aref dun-translate-table (aref str i)))
  1341. (setq i (1+ i)))
  1342. (erase-buffer)
  1343. (insert str)))
  1344.  
  1345. ;;;;
  1346. ;;;; This section defines the globals that are used in dunnet.
  1347. ;;;;
  1348. ;;;; IMPORTANT
  1349. ;;;; All globals which can change must be saved from 'save-game. Add
  1350. ;;;; all new globals to bottom of file.
  1351.  
  1352. (setq dun-visited '(27))
  1353. (setq dun-current-room 1)
  1354. (setq dun-exitf nil)
  1355. (setq dun-badcd nil)
  1356. (define-obsolete-variable-alias 'dungeon-mode-map 'dun-mode-map "22.1")
  1357. (define-key dun-mode-map "\r" 'dun-parse)
  1358. (defvar dungeon-batch-map (make-keymap))
  1359. (if (string= (substring emacs-version 0 2) "18")
  1360. (let (n)
  1361. (setq n 32)
  1362. (while (< 0 (setq n (- n 1)))
  1363. (aset dungeon-batch-map n 'dungeon-nil)))
  1364. (let (n)
  1365. (setq n 32)
  1366. (while (< 0 (setq n (- n 1)))
  1367. (aset (car (cdr dungeon-batch-map)) n 'dungeon-nil))))
  1368. (define-key dungeon-batch-map "\r" 'exit-minibuffer)
  1369. (define-key dungeon-batch-map "\n" 'exit-minibuffer)
  1370. (setq dun-computer nil)
  1371. (setq dun-floppy nil)
  1372. (setq dun-key-level 0)
  1373. (setq dun-hole nil)
  1374. (setq dun-correct-answer nil)
  1375. (setq dun-lastdir 0)
  1376. (setq dun-numsaves 0)
  1377. (setq dun-jar nil)
  1378. (setq dun-dead nil)
  1379. (setq room 0)
  1380. (setq dun-numcmds 0)
  1381. (setq dun-wizard nil)
  1382. (setq dun-endgame-question nil)
  1383. (setq dun-logged-in nil)
  1384. (setq dungeon-mode 'dungeon)
  1385. (setq dun-unix-verbs '((ls . dun-ls) (ftp . dun-ftp) (echo . dun-echo)
  1386. (exit . dun-uexit) (cd . dun-cd) (pwd . dun-pwd)
  1387. (rlogin . dun-rlogin) (uncompress . dun-uncompress)
  1388. (cat . dun-cat) (zippy . dun-zippy)))
  1389.  
  1390. (setq dun-dos-verbs '((dir . dun-dos-dir) (type . dun-dos-type)
  1391. (exit . dun-dos-exit) (command . dun-dos-spawn)
  1392. (b: . dun-dos-invd) (c: . dun-dos-invd)
  1393. (a: . dun-dos-nil)))
  1394.  
  1395.  
  1396. (setq dun-batch-mode nil)
  1397.  
  1398. (setq dun-cdpath "/usr/toukmond")
  1399. (setq dun-cdroom -10)
  1400. (setq dun-uncompressed nil)
  1401. (setq dun-ethernet t)
  1402. (setq dun-restricted
  1403. '(dun-room-objects dungeon-map dun-rooms
  1404. dun-room-silents dun-combination))
  1405. (setq dun-ftptype 'ascii)
  1406. (setq dun-endgame nil)
  1407. (setq dun-gottago t)
  1408. (setq dun-black nil)
  1409.  
  1410. (setq dun-rooms '(
  1411. (
  1412. "You are in the treasure room. A door leads out to the north."
  1413. "Treasure room"
  1414. )
  1415. (
  1416. "You are at a dead end of a dirt road. The road goes to the east.
  1417. In the distance you can see that it will eventually fork off. The
  1418. trees here are very tall royal palms, and they are spaced equidistant
  1419. from each other."
  1420. "Dead end"
  1421. )
  1422. (
  1423. "You are on the continuation of a dirt road. There are more trees on
  1424. both sides of you. The road continues to the east and west."
  1425. "E/W Dirt road"
  1426. )
  1427. (
  1428. "You are at a fork of two passages, one to the northeast, and one to the
  1429. southeast. The ground here seems very soft. You can also go back west."
  1430. "Fork"
  1431. )
  1432. (
  1433. "You are on a northeast/southwest road."
  1434. "NE/SW road"
  1435. )
  1436. (
  1437. "You are at the end of the road. There is a building in front of you
  1438. to the northeast, and the road leads back to the southwest."
  1439. "Building front"
  1440. )
  1441. (
  1442. "You are on a southeast/northwest road."
  1443. "SE/NW road"
  1444. )
  1445. (
  1446. "You are standing at the end of a road. A passage leads back to the
  1447. northwest."
  1448. "Bear hangout"
  1449. )
  1450. (
  1451. "You are in the hallway of an old building. There are rooms to the east
  1452. and west, and doors leading out to the north and south."
  1453. "Old Building hallway"
  1454. )
  1455. (
  1456. "You are in a mailroom. There are many bins where the mail is usually
  1457. kept. The exit is to the west."
  1458. "Mailroom"
  1459. )
  1460. (
  1461. "You are in a computer room. It seems like most of the equipment has
  1462. been removed. There is a VAX 11/780 in front of you, however, with
  1463. one of the cabinets wide open. A sign on the front of the machine
  1464. says: This VAX is named 'pokey'. To type on the console, use the
  1465. 'type' command. The exit is to the east."
  1466. "Computer room"
  1467. )
  1468. (
  1469. "You are in a meadow in the back of an old building. A small path leads
  1470. to the west, and a door leads to the south."
  1471. "Meadow"
  1472. )
  1473. (
  1474. "You are in a round, stone room with a door to the east. There
  1475. is a sign on the wall that reads: 'receiving room'."
  1476. "Receiving room"
  1477. )
  1478. (
  1479. "You are at the south end of a hallway that leads to the north. There
  1480. are rooms to the east and west."
  1481. "Northbound Hallway"
  1482. )
  1483. (
  1484. "You are in a sauna. There is nothing in the room except for a dial
  1485. on the wall. A door leads out to west."
  1486. "Sauna"
  1487. )
  1488. (
  1489. "You are at the end of a north/south hallway. You can go back to the south,
  1490. or off to a room to the east."
  1491. "End of N/S Hallway"
  1492. )
  1493. (
  1494. "You are in an old weight room. All of the equipment is either destroyed
  1495. or completely broken. There is a door out to the west, and there is a ladder
  1496. leading down a hole in the floor."
  1497. "Weight room" ;16
  1498. )
  1499. (
  1500. "You are in a maze of twisty little passages, all alike.
  1501. There is a button on the ground here."
  1502. "Maze button room"
  1503. )
  1504. (
  1505. "You are in a maze of little twisty passages, all alike."
  1506. "Maze"
  1507. )
  1508. (
  1509. "You are in a maze of thirsty little passages, all alike."
  1510. "Maze" ;19
  1511. )
  1512. (
  1513. "You are in a maze of twenty little passages, all alike."
  1514. "Maze"
  1515. )
  1516. (
  1517. "You are in a daze of twisty little passages, all alike."
  1518. "Maze" ;21
  1519. )
  1520. (
  1521. "You are in a maze of twisty little cabbages, all alike."
  1522. "Maze" ;22
  1523. )
  1524. (
  1525. "You are in a reception area for a health and fitness center. The place
  1526. appears to have been recently ransacked, and nothing is left. There is
  1527. a door out to the south, and a crawlspace to the southeast."
  1528. "Reception area"
  1529. )
  1530. (
  1531. "You are outside a large building to the north which used to be a health
  1532. and fitness center. A road leads to the south."
  1533. "Health Club front"
  1534. )
  1535. (
  1536. "You are at the north side of a lake. On the other side you can see
  1537. a road which leads to a cave. The water appears very deep."
  1538. "Lakefront North"
  1539. )
  1540. (
  1541. "You are at the south side of a lake. A road goes to the south."
  1542. "Lakefront South"
  1543. )
  1544. (
  1545. "You are in a well-hidden area off to the side of a road. Back to the
  1546. northeast through the brush you can see the bear hangout."
  1547. "Hidden area"
  1548. )
  1549. (
  1550. "The entrance to a cave is to the south. To the north, a road leads
  1551. towards a deep lake. On the ground nearby there is a chute, with a sign
  1552. that says 'put treasures here for points'."
  1553. "Cave Entrance" ;28
  1554. )
  1555. (
  1556. "You are in a misty, humid room carved into a mountain.
  1557. To the north is the remains of a rockslide. To the east, a small
  1558. passage leads away into the darkness." ;29
  1559. "Misty Room"
  1560. )
  1561. (
  1562. "You are in an east/west passageway. The walls here are made of
  1563. multicolored rock and are quite beautiful."
  1564. "Cave E/W passage" ;30
  1565. )
  1566. (
  1567. "You are at the junction of two passages. One goes north/south, and
  1568. the other goes west."
  1569. "N/S/W Junction" ;31
  1570. )
  1571. (
  1572. "You are at the north end of a north/south passageway. There are stairs
  1573. leading down from here. There is also a door leading west."
  1574. "North end of cave passage" ;32
  1575. )
  1576. (
  1577. "You are at the south end of a north/south passageway. There is a hole
  1578. in the floor here, into which you could probably fit."
  1579. "South end of cave passage" ;33
  1580. )
  1581. (
  1582. "You are in what appears to be a worker's bedroom. There is a queen-
  1583. sized bed in the middle of the room, and a painting hanging on the
  1584. wall. A door leads to another room to the south, and stairways
  1585. lead up and down."
  1586. "Bedroom" ;34
  1587. )
  1588. (
  1589. "You are in a bathroom built for workers in the cave. There is a
  1590. urinal hanging on the wall, and some exposed pipes on the opposite
  1591. wall where a sink used to be. To the north is a bedroom."
  1592. "Bathroom" ;35
  1593. )
  1594. (
  1595. "This is a marker for the urinal. User will not see this, but it
  1596. is a room that can contain objects."
  1597. "Urinal" ;36
  1598. )
  1599. (
  1600. "You are at the northeast end of a northeast/southwest passageway.
  1601. Stairs lead up out of sight."
  1602. "NE end of NE/SW cave passage" ;37
  1603. )
  1604. (
  1605. "You are at the junction of northeast/southwest and east/west passages."
  1606. "NE/SW-E/W junction" ;38
  1607. )
  1608. (
  1609. "You are at the southwest end of a northeast/southwest passageway."
  1610. "SW end of NE/SW cave passage" ;39
  1611. )
  1612. (
  1613. "You are at the east end of an E/W passage. There are stairs leading up
  1614. to a room above."
  1615. "East end of E/W cave passage" ;40
  1616. )
  1617. (
  1618. "You are at the west end of an E/W passage. There is a hole on the ground
  1619. which leads down out of sight."
  1620. "West end of E/W cave passage" ;41
  1621. )
  1622. (
  1623. "You are in a room which is bare, except for a horseshoe shaped boulder
  1624. in the center. Stairs lead down from here." ;42
  1625. "Horseshoe boulder room"
  1626. )
  1627. (
  1628. "You are in a room which is completely empty. Doors lead out to the north
  1629. and east."
  1630. "Empty room" ;43
  1631. )
  1632. (
  1633. "You are in an empty room. Interestingly enough, the stones in this
  1634. room are painted blue. Doors lead out to the east and south." ;44
  1635. "Blue room"
  1636. )
  1637. (
  1638. "You are in an empty room. Interestingly enough, the stones in this
  1639. room are painted yellow. Doors lead out to the south and west." ;45
  1640. "Yellow room"
  1641. )
  1642. (
  1643. "You are in an empty room. Interestingly enough, the stones in this room
  1644. are painted red. Doors lead out to the west and north."
  1645. "Red room" ;46
  1646. )
  1647. (
  1648. "You are in the middle of a long north/south hallway." ;47
  1649. "Long n/s hallway"
  1650. )
  1651. (
  1652. "You are 3/4 of the way towards the north end of a long north/south hallway."
  1653. "3/4 north" ;48
  1654. )
  1655. (
  1656. "You are at the north end of a long north/south hallway. There are stairs
  1657. leading upwards."
  1658. "North end of long hallway" ;49
  1659. )
  1660. (
  1661. "You are 3/4 of the way towards the south end of a long north/south hallway."
  1662. "3/4 south" ;50
  1663. )
  1664. (
  1665. "You are at the south end of a long north/south hallway. There is a hole
  1666. to the south."
  1667. "South end of long hallway" ;51
  1668. )
  1669. (
  1670. "You are at a landing in a stairwell which continues up and down."
  1671. "Stair landing" ;52
  1672. )
  1673. (
  1674. "You are at the continuation of an up/down staircase."
  1675. "Up/down staircase" ;53
  1676. )
  1677. (
  1678. "You are at the top of a staircase leading down. A crawlway leads off
  1679. to the northeast."
  1680. "Top of staircase." ;54
  1681. )
  1682. (
  1683. "You are in a crawlway that leads northeast or southwest."
  1684. "NE crawlway" ;55
  1685. )
  1686. (
  1687. "You are in a small crawlspace. There is a hole in the ground here, and
  1688. a small passage back to the southwest."
  1689. "Small crawlspace" ;56
  1690. )
  1691. (
  1692. "You are in the Gamma Computing Center. An IBM 3090/600s is whirring
  1693. away in here. There is an ethernet cable coming out of one of the units,
  1694. and going through the ceiling. There is no console here on which you
  1695. could type."
  1696. "Gamma computing center" ;57
  1697. )
  1698. (
  1699. "You are near the remains of a post office. There is a mail drop on the
  1700. face of the building, but you cannot see where it leads. A path leads
  1701. back to the east, and a road leads to the north."
  1702. "Post office" ;58
  1703. )
  1704. (
  1705. "You are at the intersection of Main Street and Maple Ave. Main street
  1706. runs north and south, and Maple Ave runs east off into the distance.
  1707. If you look north and east you can see many intersections, but all of
  1708. the buildings that used to stand here are gone. Nothing remains except
  1709. street signs.
  1710. There is a road to the northwest leading to a gate that guards a building."
  1711. "Main-Maple intersection" ;59
  1712. )
  1713. (
  1714. "You are at the intersection of Main Street and the west end of Oaktree Ave."
  1715. "Main-Oaktree intersection" ;60
  1716. )
  1717. (
  1718. "You are at the intersection of Main Street and the west end of Vermont Ave."
  1719. "Main-Vermont intersection" ;61
  1720. )
  1721. (
  1722. "You are at the north end of Main Street at the west end of Sycamore Ave." ;62
  1723. "Main-Sycamore intersection"
  1724. )
  1725. (
  1726. "You are at the south end of First Street at Maple Ave." ;63
  1727. "First-Maple intersection"
  1728. )
  1729. (
  1730. "You are at the intersection of First Street and Oaktree Ave." ;64
  1731. "First-Oaktree intersection"
  1732. )
  1733. (
  1734. "You are at the intersection of First Street and Vermont Ave." ;65
  1735. "First-Vermont intersection"
  1736. )
  1737. (
  1738. "You are at the north end of First Street at Sycamore Ave." ;66
  1739. "First-Sycamore intersection"
  1740. )
  1741. (
  1742. "You are at the south end of Second Street at Maple Ave." ;67
  1743. "Second-Maple intersection"
  1744. )
  1745. (
  1746. "You are at the intersection of Second Street and Oaktree Ave." ;68
  1747. "Second-Oaktree intersection"
  1748. )
  1749. (
  1750. "You are at the intersection of Second Street and Vermont Ave." ;69
  1751. "Second-Vermont intersection"
  1752. )
  1753. (
  1754. "You are at the north end of Second Street at Sycamore Ave." ;70
  1755. "Second-Sycamore intersection"
  1756. )
  1757. (
  1758. "You are at the south end of Third Street at Maple Ave." ;71
  1759. "Third-Maple intersection"
  1760. )
  1761. (
  1762. "You are at the intersection of Third Street and Oaktree Ave." ;72
  1763. "Third-Oaktree intersection"
  1764. )
  1765. (
  1766. "You are at the intersection of Third Street and Vermont Ave." ;73
  1767. "Third-Vermont intersection"
  1768. )
  1769. (
  1770. "You are at the north end of Third Street at Sycamore Ave." ;74
  1771. "Third-Sycamore intersection"
  1772. )
  1773. (
  1774. "You are at the south end of Fourth Street at Maple Ave." ;75
  1775. "Fourth-Maple intersection"
  1776. )
  1777. (
  1778. "You are at the intersection of Fourth Street and Oaktree Ave." ;76
  1779. "Fourth-Oaktree intersection"
  1780. )
  1781. (
  1782. "You are at the intersection of Fourth Street and Vermont Ave." ;77
  1783. "Fourth-Vermont intersection"
  1784. )
  1785. (
  1786. "You are at the north end of Fourth Street at Sycamore Ave." ;78
  1787. "Fourth-Sycamore intersection"
  1788. )
  1789. (
  1790. "You are at the south end of Fifth Street at the east end of Maple Ave." ;79
  1791. "Fifth-Maple intersection"
  1792. )
  1793. (
  1794. "You are at the intersection of Fifth Street and the east end of Oaktree Ave.
  1795. There is a cliff off to the east."
  1796. "Fifth-Oaktree intersection" ;80
  1797. )
  1798. (
  1799. "You are at the intersection of Fifth Street and the east end of Vermont Ave."
  1800. "Fifth-Vermont intersection" ;81
  1801. )
  1802. (
  1803. "You are at the north end of Fifth Street and the east end of Sycamore Ave."
  1804. "Fifth-Sycamore intersection" ;82
  1805. )
  1806. (
  1807. "You are in front of the Museum of Natural History. A door leads into
  1808. the building to the north, and a road leads to the southeast."
  1809. "Museum entrance" ;83
  1810. )
  1811. (
  1812. "You are in the main lobby for the Museum of Natural History. In the center
  1813. of the room is the huge skeleton of a dinosaur. Doors lead out to the
  1814. south and east."
  1815. "Museum lobby" ;84
  1816. )
  1817. (
  1818. "You are in the geological display. All of the objects that used to
  1819. be on display are missing. There are rooms to the east, west, and
  1820. north."
  1821. "Geological display" ;85
  1822. )
  1823. (
  1824. "You are in the marine life area. The room is filled with fish tanks,
  1825. which are filled with dead fish that have apparently died due to
  1826. starvation. Doors lead out to the south and east."
  1827. "Marine life area" ;86
  1828. )
  1829. (
  1830. "You are in some sort of maintenance room for the museum. There is a
  1831. switch on the wall labeled 'BL'. There are doors to the west and north."
  1832. "Maintenance room" ;87
  1833. )
  1834. (
  1835. "You are in a classroom where school children were taught about natural
  1836. history. On the blackboard is written, 'No children allowed downstairs.'
  1837. There is a door to the east with an 'exit' sign on it. There is another
  1838. door to the west."
  1839. "Classroom" ;88
  1840. )
  1841. (
  1842. "You are at the Vermont St. subway station. A train is sitting here waiting."
  1843. "Vermont station" ;89
  1844. )
  1845. (
  1846. "You are at the Museum subway stop. A passage leads off to the north."
  1847. "Museum station" ;90
  1848. )
  1849. (
  1850. "You are in a north/south tunnel."
  1851. "N/S tunnel" ;91
  1852. )
  1853. (
  1854. "You are at the north end of a north/south tunnel. Stairs lead up and
  1855. down from here. There is a garbage disposal here."
  1856. "North end of N/S tunnel" ;92
  1857. )
  1858. (
  1859. "You are at the top of some stairs near the subway station. There is
  1860. a door to the west."
  1861. "Top of subway stairs" ;93
  1862. )
  1863. (
  1864. "You are at the bottom of some stairs near the subway station. There is
  1865. a room to the northeast."
  1866. "Bottom of subway stairs" ;94
  1867. )
  1868. (
  1869. "You are in another computer room. There is a computer in here larger
  1870. than you have ever seen. It has no manufacturers name on it, but it
  1871. does have a sign that says: This machine's name is 'endgame'. The
  1872. exit is to the southwest. There is no console here on which you could
  1873. type."
  1874. "Endgame computer room" ;95
  1875. )
  1876. (
  1877. "You are in a north/south hallway."
  1878. "Endgame N/S hallway" ;96
  1879. )
  1880. (
  1881. "You have reached a question room. You must answer a question correctly in
  1882. order to get by. Use the 'answer' command to answer the question."
  1883. "Question room 1" ;97
  1884. )
  1885. (
  1886. "You are in a north/south hallway."
  1887. "Endgame N/S hallway" ;98
  1888. )
  1889. (
  1890. "You are in a second question room."
  1891. "Question room 2" ;99
  1892. )
  1893. (
  1894. "You are in a north/south hallway."
  1895. "Endgame N/S hallway" ;100
  1896. )
  1897. (
  1898. "You are in a third question room."
  1899. "Question room 3" ;101
  1900. )
  1901. (
  1902. "You are in the endgame treasure room. A door leads out to the north, and
  1903. a hallway leads to the south."
  1904. "Endgame treasure room" ;102
  1905. )
  1906. (
  1907. "You are in the winner's room. A door leads back to the south."
  1908. "Winner's room" ;103
  1909. )
  1910. (
  1911. "You have reached a dead end. There is a PC on the floor here. Above
  1912. it is a sign that reads:
  1913. Type the 'reset' command to type on the PC.
  1914. A hole leads north."
  1915. "PC area" ;104
  1916. )
  1917. ))
  1918.  
  1919. (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
  1920. 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
  1921. 77 78 79 80 81 82 83))
  1922.  
  1923. (setq dun-verblist '((die . dun-die) (ne . dun-ne) (north . dun-n)
  1924. (south . dun-s) (east . dun-e) (west . dun-w)
  1925. (u . dun-up) (d . dun-down) (i . dun-inven)
  1926. (inventory . dun-inven) (look . dun-examine) (n . dun-n)
  1927. (s . dun-s) (e . dun-e) (w . dun-w) (se . dun-se)
  1928. (nw . dun-nw) (sw . dun-sw) (up . dun-up)
  1929. (down . dun-down) (in . dun-in) (out . dun-out)
  1930. (go . dun-go) (drop . dun-drop) (southeast . dun-se)
  1931. (southwest . dun-sw) (northeast . dun-ne)
  1932. (northwest . dun-nw) (save . dun-save-game)
  1933. (restore . dun-restore) (long . dun-long) (dig . dun-dig)
  1934. (shake . dun-shake) (wave . dun-shake)
  1935. (examine . dun-examine) (describe . dun-examine)
  1936. (climb . dun-climb) (eat . dun-eat) (put . dun-put)
  1937. (type . dun-type) (insert . dun-put)
  1938. (score . dun-score) (help . dun-help) (quit . dun-quit)
  1939. (read . dun-examine) (verbose . dun-long)
  1940. (urinate . dun-piss) (piss . dun-piss)
  1941. (flush . dun-flush) (sleep . dun-sleep) (lie . dun-sleep)
  1942. (x . dun-examine) (break . dun-break) (drive . dun-drive)
  1943. (board . dun-in) (enter . dun-in) (turn . dun-turn)
  1944. (press . dun-press) (push . dun-press) (swim . dun-swim)
  1945. (on . dun-in) (off . dun-out) (chop . dun-break)
  1946. (switch . dun-press) (cut . dun-break) (exit . dun-out)
  1947. (leave . dun-out) (reset . dun-power) (flick . dun-press)
  1948. (superb . dun-superb) (answer . dun-answer)
  1949. (throw . dun-drop) (l . dun-examine) (take . dun-take)
  1950. (get . dun-take) (feed . dun-feed)))
  1951.  
  1952. (setq dun-inbus nil)
  1953. (setq dun-nomail nil)
  1954. (setq dun-ignore '(the to at))
  1955. (setq dun-mode 'moby)
  1956. (setq dun-sauna-level 0)
  1957.  
  1958. (defconst north 0)
  1959. (defconst south 1)
  1960. (defconst east 2)
  1961. (defconst west 3)
  1962. (defconst northeast 4)
  1963. (defconst southeast 5)
  1964. (defconst northwest 6)
  1965. (defconst southwest 7)
  1966. (defconst up 8)
  1967. (defconst down 9)
  1968. (defconst in 10)
  1969. (defconst out 11)
  1970.  
  1971. (setq dungeon-map '(
  1972. ; no so ea we ne se nw sw up do in ot
  1973. ( 96 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;0
  1974. ( -1 -1 2 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;1
  1975. ( -1 -1 3 1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;2
  1976. ( -1 -1 -1 2 4 6 -1 -1 -1 -1 -1 -1 ) ;3
  1977. ( -1 -1 -1 -1 5 -1 -1 3 -1 -1 -1 -1 ) ;4
  1978. ( -1 -1 -1 -1 255 -1 -1 4 -1 -1 255 -1 ) ;5
  1979. ( -1 -1 -1 -1 -1 7 3 -1 -1 -1 -1 -1 ) ;6
  1980. ( -1 -1 -1 -1 -1 255 6 27 -1 -1 -1 -1 ) ;7
  1981. ( 255 5 9 10 -1 -1 -1 5 -1 -1 -1 5 ) ;8
  1982. ( -1 -1 -1 8 -1 -1 -1 -1 -1 -1 -1 -1 ) ;9
  1983. ( -1 -1 8 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;10
  1984. ( -1 8 -1 58 -1 -1 -1 -1 -1 -1 -1 -1 ) ;11
  1985. ( -1 -1 13 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;12
  1986. ( 15 -1 14 12 -1 -1 -1 -1 -1 -1 -1 -1 ) ;13
  1987. ( -1 -1 -1 13 -1 -1 -1 -1 -1 -1 -1 -1 ) ;14
  1988. ( -1 13 16 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;15
  1989. ( -1 -1 -1 15 -1 -1 -1 -1 -1 17 16 -1 ) ;16
  1990. ( -1 -1 17 17 17 17 255 17 255 17 -1 -1 ) ;17
  1991. ( 18 18 18 18 18 -1 18 18 19 18 -1 -1 ) ;18
  1992. ( -1 18 18 19 19 20 19 19 -1 18 -1 -1 ) ;19
  1993. ( -1 -1 -1 18 -1 -1 -1 -1 -1 21 -1 -1 ) ;20
  1994. ( -1 -1 -1 -1 -1 20 22 -1 -1 -1 -1 -1 ) ;21
  1995. ( 18 18 18 18 16 18 23 18 18 18 18 18 ) ;22
  1996. ( -1 255 -1 -1 -1 19 -1 -1 -1 -1 -1 -1 ) ;23
  1997. ( 23 25 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;24
  1998. ( 24 255 -1 -1 -1 -1 -1 -1 -1 -1 255 -1 ) ;25
  1999. (255 28 -1 -1 -1 -1 -1 -1 -1 -1 255 -1 ) ;26
  2000. ( -1 -1 -1 -1 7 -1 -1 -1 -1 -1 -1 -1 ) ;27
  2001. ( 26 255 -1 -1 -1 -1 -1 -1 -1 -1 255 -1 ) ;28
  2002. ( -1 -1 30 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;29
  2003. ( -1 -1 31 29 -1 -1 -1 -1 -1 -1 -1 -1 ) ;30
  2004. ( 32 33 -1 30 -1 -1 -1 -1 -1 -1 -1 -1 ) ;31
  2005. ( -1 31 -1 255 -1 -1 -1 -1 -1 34 -1 -1 ) ;32
  2006. ( 31 -1 -1 -1 -1 -1 -1 -1 -1 35 -1 -1 ) ;33
  2007. ( -1 35 -1 -1 -1 -1 -1 -1 32 37 -1 -1 ) ;34
  2008. ( 34 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;35
  2009. ( -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;36
  2010. ( -1 -1 -1 -1 -1 -1 -1 38 34 -1 -1 -1 ) ;37
  2011. ( -1 -1 40 41 37 -1 -1 39 -1 -1 -1 -1 ) ;38
  2012. ( -1 -1 -1 -1 38 -1 -1 -1 -1 -1 -1 -1 ) ;39
  2013. ( -1 -1 -1 38 -1 -1 -1 -1 42 -1 -1 -1 ) ;40
  2014. ( -1 -1 38 -1 -1 -1 -1 -1 -1 43 -1 -1 ) ;41
  2015. ( -1 -1 -1 -1 -1 -1 -1 -1 -1 40 -1 -1 ) ;42
  2016. ( 44 -1 46 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;43
  2017. ( -1 43 45 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;44
  2018. ( -1 46 -1 44 -1 -1 -1 -1 -1 -1 -1 -1 ) ;45
  2019. ( 45 -1 -1 43 -1 -1 -1 -1 -1 255 -1 -1 ) ;46
  2020. ( 48 50 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;47
  2021. ( 49 47 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;48
  2022. ( -1 48 -1 -1 -1 -1 -1 -1 52 -1 -1 -1 ) ;49
  2023. ( 47 51 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;50
  2024. ( 50 104 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;51
  2025. ( -1 -1 -1 -1 -1 -1 -1 -1 53 49 -1 -1 ) ;52
  2026. ( -1 -1 -1 -1 -1 -1 -1 -1 54 52 -1 -1 ) ;53
  2027. ( -1 -1 -1 -1 55 -1 -1 -1 -1 53 -1 -1 ) ;54
  2028. ( -1 -1 -1 -1 56 -1 -1 54 -1 -1 -1 54 ) ;55
  2029. ( -1 -1 -1 -1 -1 -1 -1 55 -1 31 -1 -1 ) ;56
  2030. ( -1 -1 32 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;57
  2031. ( 59 -1 11 -1 -1 -1 -1 -1 -1 -1 255 255) ;58
  2032. ( 60 58 63 -1 -1 -1 255 -1 -1 -1 255 255) ;59
  2033. ( 61 59 64 -1 -1 -1 -1 -1 -1 -1 255 255) ;60
  2034. ( 62 60 65 -1 -1 -1 -1 -1 -1 -1 255 255) ;61
  2035. ( -1 61 66 -1 -1 -1 -1 -1 -1 -1 255 255) ;62
  2036. ( 64 -1 67 59 -1 -1 -1 -1 -1 -1 255 255) ;63
  2037. ( 65 63 68 60 -1 -1 -1 -1 -1 -1 255 255) ;64
  2038. ( 66 64 69 61 -1 -1 -1 -1 -1 -1 255 255) ;65
  2039. ( -1 65 70 62 -1 -1 -1 -1 -1 -1 255 255) ;66
  2040. ( 68 -1 71 63 -1 -1 -1 -1 -1 -1 255 255) ;67
  2041. ( 69 67 72 64 -1 -1 -1 -1 -1 -1 255 255) ;68
  2042. ( 70 68 73 65 -1 -1 -1 -1 -1 -1 255 255) ;69
  2043. ( -1 69 74 66 -1 -1 -1 -1 -1 -1 255 255) ;70
  2044. ( 72 -1 75 67 -1 -1 -1 -1 -1 -1 255 255) ;71
  2045. ( 73 71 76 68 -1 -1 -1 -1 -1 -1 255 255) ;72
  2046. ( 74 72 77 69 -1 -1 -1 -1 -1 -1 255 255) ;73
  2047. ( -1 73 78 70 -1 -1 -1 -1 -1 -1 255 255) ;74
  2048. ( 76 -1 79 71 -1 -1 -1 -1 -1 -1 255 255) ;75
  2049. ( 77 75 80 72 -1 -1 -1 -1 -1 -1 255 255) ;76
  2050. ( 78 76 81 73 -1 -1 -1 -1 -1 -1 255 255) ;77
  2051. ( -1 77 82 74 -1 -1 -1 -1 -1 -1 255 255) ;78
  2052. ( 80 -1 -1 75 -1 -1 -1 -1 -1 -1 255 255) ;79
  2053. ( 81 79 255 76 -1 -1 -1 -1 -1 -1 255 255) ;80
  2054. ( 82 80 -1 77 -1 -1 -1 -1 -1 -1 255 255) ;81
  2055. ( -1 81 -1 78 -1 -1 -1 -1 -1 -1 255 255) ;82
  2056. ( 84 -1 -1 -1 -1 59 -1 -1 -1 -1 255 255) ;83
  2057. ( -1 83 85 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;84
  2058. ( 86 -1 87 84 -1 -1 -1 -1 -1 -1 -1 -1 ) ;85
  2059. ( -1 85 88 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;86
  2060. ( 88 -1 -1 85 -1 -1 -1 -1 -1 -1 -1 -1 ) ;87
  2061. ( -1 87 255 86 -1 -1 -1 -1 -1 -1 -1 -1 ) ;88
  2062. ( -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 255 -1 ) ;89
  2063. ( 91 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;90
  2064. ( 92 90 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;91
  2065. ( -1 91 -1 -1 -1 -1 -1 -1 93 94 -1 -1 ) ;92
  2066. ( -1 -1 -1 88 -1 -1 -1 -1 -1 92 -1 -1 ) ;93
  2067. ( -1 -1 -1 -1 95 -1 -1 -1 92 -1 -1 -1 ) ;94
  2068. ( -1 -1 -1 -1 -1 -1 -1 94 -1 -1 -1 -1 ) ;95
  2069. ( 97 0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;96
  2070. ( -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;97
  2071. ( 99 97 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;98
  2072. ( -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;99
  2073. ( 101 99 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;100
  2074. ( -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;101
  2075. ( 103 101 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;102
  2076. ( -1 102 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;103
  2077. ( 51 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 ) ;104
  2078. )
  2079. ; no so ea we ne se nw sw up do in ot
  2080. )
  2081.  
  2082.  
  2083. ;;; How the user references *all* objects, permanent and regular.
  2084. (setq dun-objnames '(
  2085. (shovel . 0)
  2086. (lamp . 1)
  2087. (cpu . 2) (board . 2) (card . 2) (chip . 2)
  2088. (food . 3)
  2089. (key . 4)
  2090. (paper . 5) (slip . 5)
  2091. (rms . 6) (statue . 6) (statuette . 6) (stallman . 6)
  2092. (diamond . 7)
  2093. (weight . 8)
  2094. (life . 9) (preserver . 9)
  2095. (bracelet . 10) (emerald . 10)
  2096. (gold . 11)
  2097. (platinum . 12)
  2098. (towel . 13) (beach . 13)
  2099. (axe . 14)
  2100. (silver . 15)
  2101. (license . 16)
  2102. (coins . 17)
  2103. (egg . 18)
  2104. (jar . 19)
  2105. (bone . 20)
  2106. (acid . 21) (nitric . 21)
  2107. (glycerine . 22)
  2108. (ruby . 23)
  2109. (amethyst . 24)
  2110. (mona . 25)
  2111. (bill . 26)
  2112. (floppy . 27) (disk . 27)
  2113.  
  2114. (boulder . -1)
  2115. (tree . -2) (trees . -2) (palm . -2)
  2116. (bear . -3)
  2117. (bin . -4) (bins . -4)
  2118. (cabinet . -5) (computer . -5) (vax . -5) (ibm . -5)
  2119. (protoplasm . -6)
  2120. (dial . -7)
  2121. (button . -8)
  2122. (chute . -9)
  2123. (painting . -10)
  2124. (bed . -11)
  2125. (urinal . -12)
  2126. (URINE . -13)
  2127. (pipes . -14) (pipe . -14)
  2128. (box . -15) (slit . -15)
  2129. (cable . -16) (ethernet . -16)
  2130. (mail . -17) (drop . -17)
  2131. (bus . -18)
  2132. (gate . -19)
  2133. (cliff . -20)
  2134. (skeleton . -21) (dinosaur . -21)
  2135. (fish . -22)
  2136. (tanks . -23) (tank . -23)
  2137. (switch . -24)
  2138. (blackboard . -25)
  2139. (disposal . -26) (garbage . -26)
  2140. (ladder . -27)
  2141. (subway . -28) (train . -28)
  2142. (pc . -29) (drive . -29) (coconut . -30) (coconuts . -30)
  2143. (lake . -32) (water . -32)
  2144. ))
  2145.  
  2146. (dolist (x dun-objnames)
  2147. (let (name)
  2148. (setq name (concat "obj-" (prin1-to-string (car x))))
  2149. (eval (list 'defconst (intern name) (cdr x)))))
  2150.  
  2151. (defconst obj-special 255)
  2152.  
  2153. ;;; The initial setup of what objects are in each room.
  2154. ;;; Regular objects have whole numbers lower than 255.
  2155. ;;; Objects that cannot be taken but might move and are
  2156. ;;; described during room description are negative.
  2157. ;;; Stuff that is described and might change are 255, and are
  2158. ;;; handled specially by 'dun-describe-room.
  2159.  
  2160. (setq dun-room-objects (list nil
  2161.  
  2162. (list obj-shovel) ;; treasure-room
  2163. (list obj-boulder) ;; dead-end
  2164. nil nil nil
  2165. (list obj-food) ;; se-nw-road
  2166. (list obj-bear) ;; bear-hangout
  2167. nil nil
  2168. (list obj-special) ;; computer-room
  2169. (list obj-lamp obj-license obj-silver);; meadow
  2170. nil nil
  2171. (list obj-special) ;; sauna
  2172. nil
  2173. (list obj-weight obj-life) ;; weight-room
  2174. nil nil
  2175. (list obj-rms obj-floppy) ;; thirsty-maze
  2176. nil nil nil nil nil nil nil
  2177. (list obj-emerald) ;; hidden-area
  2178. nil
  2179. (list obj-gold) ;; misty-room
  2180. nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
  2181. (list obj-towel obj-special) ;; red-room
  2182. nil nil nil nil nil
  2183. (list obj-box) ;; stair-landing
  2184. nil nil nil
  2185. (list obj-axe) ;; small-crawlspace
  2186. nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
  2187. nil nil nil nil nil
  2188. (list obj-special) ;; fourth-vermont-intersection
  2189. nil nil
  2190. (list obj-coins) ;; fifth-oaktree-intersection
  2191. nil
  2192. (list obj-bus) ;; fifth-sycamore-intersection
  2193. nil
  2194. (list obj-bone) ;; museum-lobby
  2195. nil
  2196. (list obj-jar obj-special obj-ruby) ;; marine-life-area
  2197. (list obj-nitric) ;; maintenance-room
  2198. (list obj-glycerine) ;; classroom
  2199. nil nil nil nil nil
  2200. (list obj-amethyst) ;; bottom-of-subway-stairs
  2201. nil nil
  2202. (list obj-special) ;; question-room-1
  2203. nil
  2204. (list obj-special) ;; question-room-2
  2205. nil
  2206. (list obj-special) ;; question-room-three
  2207. nil
  2208. (list obj-mona) ;; winner's-room
  2209. nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil nil
  2210. nil nil nil 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
  2212. nil))
  2213.  
  2214. ;;; These are objects in a room that are only described in the
  2215. ;;; room description. They are permanent.
  2216.  
  2217. (setq dun-room-silents (list nil
  2218. (list obj-tree obj-coconut) ;; dead-end
  2219. (list obj-tree obj-coconut) ;; e-w-dirt-road
  2220. nil nil nil nil nil nil
  2221. (list obj-bin) ;; mailroom
  2222. (list obj-computer) ;; computer-room
  2223. nil nil nil
  2224. (list obj-dial) ;; sauna
  2225. nil
  2226. (list obj-ladder) ;; weight-room
  2227. (list obj-button obj-ladder) ;; maze-button-room
  2228. nil nil nil
  2229. nil nil nil nil
  2230. (list obj-lake) ;; lakefront-north
  2231. (list obj-lake) ;; lakefront-south
  2232. nil
  2233. (list obj-chute) ;; cave-entrance
  2234. nil nil nil nil nil
  2235. (list obj-painting obj-bed) ;; bedroom
  2236. (list obj-urinal obj-pipes) ;; bathroom
  2237. nil nil nil nil nil nil
  2238. (list obj-boulder) ;; horseshoe-boulder-room
  2239. nil nil nil nil nil nil nil nil nil nil nil nil nil nil
  2240. (list obj-computer obj-cable) ;; gamma-computing-center
  2241. (list obj-mail) ;; post-office
  2242. (list obj-gate) ;; main-maple-intersection
  2243. nil nil nil nil nil nil nil nil nil nil nil nil nil
  2244. nil nil nil nil nil nil nil
  2245. (list obj-cliff) ;; fifth-oaktree-intersection
  2246. nil nil nil
  2247. (list obj-dinosaur) ;; museum-lobby
  2248. nil
  2249. (list obj-fish obj-tanks) ;; marine-life-area
  2250. (list obj-switch) ;; maintenance-room
  2251. (list obj-blackboard) ;; classroom
  2252. (list obj-train) ;; vermont-station
  2253. nil nil
  2254. (list obj-disposal) ;; north-end-of-n-s-tunnel
  2255. nil nil
  2256. (list obj-computer) ;; endgame-computer-room
  2257. nil nil nil nil nil nil nil nil
  2258. (list obj-pc) ;; pc-area
  2259. nil nil nil nil nil nil
  2260. ))
  2261. (setq dun-inventory '(1))
  2262.  
  2263. ;;; Descriptions of objects, as they appear in the room description, and
  2264. ;;; the inventory.
  2265.  
  2266. (setq dun-objects '(
  2267. ("There is a shovel here." "A shovel") ;0
  2268. ("There is a lamp nearby." "A lamp") ;1
  2269. ("There is a CPU card here." "A computer board") ;2
  2270. ("There is some food here." "Some food") ;3
  2271. ("There is a shiny brass key here." "A brass key") ;4
  2272. ("There is a slip of paper here." "A slip of paper") ;5
  2273. ("There is a wax statuette of Richard Stallman here." ;6
  2274. "An RMS statuette")
  2275. ("There is a shimmering diamond here." "A diamond") ;7
  2276. ("There is a 10 pound weight here." "A weight") ;8
  2277. ("There is a life preserver here." "A life preserver");9
  2278. ("There is an emerald bracelet here." "A bracelet") ;10
  2279. ("There is a gold bar here." "A gold bar") ;11
  2280. ("There is a platinum bar here." "A platinum bar") ;12
  2281. ("There is a beach towel on the ground here." "A beach towel")
  2282. ("There is an axe here." "An axe") ;14
  2283. ("There is a silver bar here." "A silver bar") ;15
  2284. ("There is a bus driver's license here." "A license") ;16
  2285. ("There are some valuable coins here." "Some valuable coins")
  2286. ("There is a jewel-encrusted egg here." "A valuable egg") ;18
  2287. ("There is a glass jar here." "A glass jar") ;19
  2288. ("There is a dinosaur bone here." "A bone") ;20
  2289. ("There is a packet of nitric acid here." "Some nitric acid")
  2290. ("There is a packet of glycerine here." "Some glycerine") ;22
  2291. ("There is a valuable ruby here." "A ruby") ;23
  2292. ("There is a valuable amethyst here." "An amethyst") ;24
  2293. ("The Mona Lisa is here." "The Mona Lisa") ;25
  2294. ("There is a 100 dollar bill here." "A $100 bill") ;26
  2295. ("There is a floppy disk here." "A floppy disk") ;27
  2296. )
  2297. )
  2298.  
  2299. ;;; Weight of objects
  2300.  
  2301. (setq dun-object-lbs
  2302. '(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))
  2303. (setq dun-object-pts
  2304. '(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))
  2305.  
  2306.  
  2307. ;;; Unix representation of objects.
  2308. (setq dun-objfiles '(
  2309. "shovel.o" "lamp.o" "cpu.o" "food.o" "key.o" "paper.o"
  2310. "rms.o" "diamond.o" "weight.o" "preserver.o" "bracelet.o"
  2311. "gold.o" "platinum.o" "towel.o" "axe.o" "silver.o" "license.o"
  2312. "coins.o" "egg.o" "jar.o" "bone.o" "nitric.o" "glycerine.o"
  2313. "ruby.o" "amethyst.o"
  2314. ))
  2315.  
  2316. ;;; These are the descriptions for the negative numbered objects from
  2317. ;;; dun-room-objects
  2318.  
  2319. (setq dun-perm-objects '(
  2320. nil
  2321. ("There is a large boulder here.")
  2322. nil
  2323. ("There is a ferocious bear here!")
  2324. nil
  2325. nil
  2326. ("There is a worthless pile of protoplasm here.")
  2327. nil
  2328. nil
  2329. nil
  2330. nil
  2331. nil
  2332. nil
  2333. ("There is a strange smell in this room.")
  2334. nil
  2335. (
  2336. "There is a box with a slit in it, bolted to the wall here."
  2337. )
  2338. nil
  2339. nil
  2340. ("There is a bus here.")
  2341. nil
  2342. nil
  2343. nil
  2344. ))
  2345.  
  2346.  
  2347. ;;; These are the descriptions the user gets when regular objects are
  2348. ;;; examined.
  2349.  
  2350. (setq dun-physobj-desc '(
  2351. "It is a normal shovel with a price tag attached that says $19.99."
  2352. "The lamp is hand-crafted by Geppetto."
  2353. "The CPU board has a VAX chip on it. It seems to have
  2354. 2 Megabytes of RAM onboard."
  2355. "It looks like some kind of meat. Smells pretty bad."
  2356. nil
  2357. "The paper says: Don't forget to type 'help' for help. Also, remember
  2358. this word: 'worms'"
  2359. "The statuette is of the likeness of Richard Stallman, the author of the
  2360. famous EMACS editor. You notice that he is not wearing any shoes."
  2361. nil
  2362. "You observe that the weight is heavy."
  2363. "It says S. S. Minnow."
  2364. nil
  2365. nil
  2366. nil
  2367. "It has a picture of snoopy on it."
  2368. nil
  2369. nil
  2370. "It has your picture on it!"
  2371. "They are old coins from the 19th century."
  2372. "It is a valuable Fabrege egg."
  2373. "It is a plain glass jar."
  2374. nil
  2375. nil
  2376. nil
  2377. nil
  2378. nil
  2379. )
  2380. )
  2381.  
  2382. ;;; These are the descriptions the user gets when non-regular objects
  2383. ;;; are examined.
  2384.  
  2385. (setq dun-permobj-desc '(
  2386. nil
  2387. "It is just a boulder. It cannot be moved."
  2388. "They are palm trees with a bountiful supply of coconuts in them."
  2389. "It looks like a grizzly to me."
  2390. "All of the bins are empty. Looking closely you can see that there
  2391. are names written at the bottom of each bin, but most of them are
  2392. faded away so that you cannot read them. You can only make out three
  2393. names:
  2394. Jeffrey Collier
  2395. Robert Toukmond
  2396. Thomas Stock
  2397. "
  2398. nil
  2399. "It is just a garbled mess."
  2400. "The dial points to a temperature scale which has long since faded away."
  2401. nil
  2402. nil
  2403. "It is a velvet painting of Elvis Presley. It seems to be nailed to the
  2404. wall, and you cannot move it."
  2405. "It is a queen sized bed, with a very firm mattress."
  2406. "The urinal is very clean compared with everything else in the cave. There
  2407. isn't even any rust. Upon close examination you realize that the drain at the
  2408. bottom is missing, and there is just a large hole leading down the
  2409. pipes into nowhere. The hole is too small for a person to fit in. The
  2410. flush handle is so clean that you can see your reflection in it."
  2411. nil
  2412. nil
  2413. "The box has a slit in the top of it, and on it, in sloppy handwriting, is
  2414. written: 'For key upgrade, put key in here.'"
  2415. nil
  2416. "It says 'express mail' on it."
  2417. "It is a 35 passenger bus with the company name 'mobytours' on it."
  2418. "It is a large metal gate that is too big to climb over."
  2419. "It is a HIGH cliff."
  2420. "Unfortunately you do not know enough about dinosaurs to tell very much about
  2421. it. It is very big, though."
  2422. "The fish look like they were once quite beautiful."
  2423. nil
  2424. nil
  2425. nil
  2426. nil
  2427. "It is a normal ladder that is permanently attached to the hole."
  2428. "It is a passenger train that is ready to go."
  2429. "It is a personal computer that has only one floppy disk drive."
  2430. )
  2431. )
  2432.  
  2433. (setq dun-diggables
  2434. (list nil nil nil (list obj-cpu) nil nil nil nil nil nil nil
  2435. nil nil nil nil nil nil nil nil nil nil ;11-20
  2436. nil nil nil nil nil nil nil nil nil nil ;21-30
  2437. nil nil nil nil nil nil nil nil nil nil ;31-40
  2438. nil (list obj-platinum) nil nil nil nil nil nil nil nil))
  2439.  
  2440. (setq dun-room-shorts nil)
  2441. (dolist (x dun-rooms)
  2442. (setq dun-room-shorts
  2443. (append dun-room-shorts (list (downcase
  2444. (dun-space-to-hyphen
  2445. (cadr x)))))))
  2446.  
  2447. (setq dun-endgame-questions '(
  2448. (
  2449. "What is your password on the machine called 'pokey'?" "robert")
  2450. (
  2451. "What password did you use during anonymous ftp to gamma?" "foo")
  2452. (
  2453. "Excluding the endgame, how many places are there where you can put
  2454. treasures for points?" "4" "four")
  2455. (
  2456. "What is your login name on the 'endgame' machine?" "toukmond"
  2457. )
  2458. (
  2459. "What is the nearest whole dollar to the price of the shovel?" "20" "twenty")
  2460. (
  2461. "What is the name of the bus company serving the town?" "mobytours")
  2462. (
  2463. "Give either of the two last names in the mailroom, other than your own."
  2464. "collier" "stock")
  2465. (
  2466. "What cartoon character is on the towel?" "snoopy")
  2467. (
  2468. "What is the last name of the author of EMACS?" "stallman")
  2469. (
  2470. "How many megabytes of memory is on the CPU board for the Vax?" "2")
  2471. (
  2472. "Which street in town is named after a U.S. state?" "vermont")
  2473. (
  2474. "How many pounds did the weight weigh?" "ten" "10")
  2475. (
  2476. "Name the STREET which runs right over the subway stop." "fourth" "4" "4th")
  2477. (
  2478. "How many corners are there in town (excluding the one with the Post Office)?"
  2479. "24" "twentyfour" "twenty-four")
  2480. (
  2481. "What type of bear was hiding your key?" "grizzly")
  2482. (
  2483. "Name either of the two objects you found by digging." "cpu" "card" "vax"
  2484. "board" "platinum")
  2485. (
  2486. "What network protocol is used between pokey and gamma?" "tcp/ip" "ip" "tcp")
  2487. ))
  2488.  
  2489. (let (a)
  2490. (setq a 0)
  2491. (dolist (x dun-room-shorts)
  2492. (eval (list 'defconst (intern x) a))
  2493. (setq a (+ a 1))))
  2494.  
  2495.  
  2496.  
  2497. ;;;;
  2498. ;;;; This section defines the UNIX emulation functions for dunnet.
  2499. ;;;;
  2500.  
  2501. (defun dun-unix-parse (args)
  2502. (interactive "*p")
  2503. (beginning-of-line)
  2504. (let (beg esign)
  2505. (setq beg (+ (point) 2))
  2506. (end-of-line)
  2507. (if (and (not (= beg (point)))
  2508. (string= "$" (buffer-substring (- beg 2) (- beg 1))))
  2509. (progn
  2510. (setq line (downcase (buffer-substring beg (point))))
  2511. (princ line)
  2512. (if (eq (dun-parse2 nil dun-unix-verbs line) -1)
  2513. (progn
  2514. (if (setq esign (string-match "=" line))
  2515. (dun-doassign line esign)
  2516. (dun-mprinc (car line-list))
  2517. (dun-mprincl ": not found.")))))
  2518. (goto-char (point-max))
  2519. (dun-mprinc "\n"))
  2520. (if (eq dungeon-mode 'unix)
  2521. (progn
  2522. (dun-fix-screen)
  2523. (dun-mprinc "$ ")))))
  2524.  
  2525. (defun dun-doassign (line esign)
  2526. (if (not dun-wizard)
  2527. (let (passwd)
  2528. (dun-mprinc "Enter wizard password: ")
  2529. (setq passwd (dun-read-line))
  2530. (if (not dun-batch-mode)
  2531. (dun-mprinc "\n"))
  2532. (if (string= passwd "moby")
  2533. (progn
  2534. (setq dun-wizard t)
  2535. (dun-doassign line esign))
  2536. (dun-mprincl "Incorrect.")))
  2537.  
  2538. (let (varname epoint afterq i value)
  2539. (setq varname (substring line 0 esign))
  2540. (if (not (setq epoint (string-match ")" line)))
  2541. (if (string= (substring line (1+ esign) (+ esign 2))
  2542. "\"")
  2543. (progn
  2544. (setq afterq (substring line (+ esign 2)))
  2545. (setq epoint (+
  2546. (string-match "\"" afterq)
  2547. (+ esign 3))))
  2548.  
  2549. (if (not (setq epoint (string-match " " line)))
  2550. (setq epoint (length line))))
  2551. (setq epoint (1+ epoint))
  2552. (while (and
  2553. (not (= epoint (length line)))
  2554. (setq i (string-match ")" (substring line epoint))))
  2555. (setq epoint (+ epoint i 1))))
  2556. (setq value (substring line (1+ esign) epoint))
  2557. (dun-eval varname value))))
  2558.  
  2559. (defun dun-eval (varname value)
  2560. (let (eval-error)
  2561. (switch-to-buffer (get-buffer-create "*dungeon-eval*"))
  2562. (erase-buffer)
  2563. (insert "(setq ")
  2564. (insert varname)
  2565. (insert " ")
  2566. (insert value)
  2567. (insert ")")
  2568. (setq eval-error nil)
  2569. (condition-case nil
  2570. (eval-buffer)
  2571. (error (setq eval-error t)))
  2572. (kill-buffer (current-buffer))
  2573. (switch-to-buffer "*dungeon*")
  2574. (if eval-error
  2575. (dun-mprincl "Invalid syntax."))))
  2576.  
  2577.  
  2578. (defun dun-unix-interface ()
  2579. (dun-login)
  2580. (if dun-logged-in
  2581. (progn
  2582. (setq dungeon-mode 'unix)
  2583. (define-key dun-mode-map "\r" 'dun-unix-parse)
  2584. (dun-mprinc "$ "))))
  2585.  
  2586. (defun dun-login ()
  2587. (let (tries username password)
  2588. (setq tries 4)
  2589. (while (and (not dun-logged-in) (> (setq tries (- tries 1)) 0))
  2590. (dun-mprinc "\n\nUNIX System V, Release 2.2 (pokey)\n\nlogin: ")
  2591. (setq username (dun-read-line))
  2592. (if (not dun-batch-mode)
  2593. (dun-mprinc "\n"))
  2594. (dun-mprinc "password: ")
  2595. (setq password (dun-read-line))
  2596. (if (not dun-batch-mode)
  2597. (dun-mprinc "\n"))
  2598. (if (or (not (string= username "toukmond"))
  2599. (not (string= password "robert")))
  2600. (dun-mprincl "login incorrect")
  2601. (setq dun-logged-in t)