home *** CD-ROM | disk | FTP | other *** search
/ Mac-Source 1994 July / Mac-Source_July_1994.iso / Other Langs / abc / examples / advent / advent.mail < prev    next >
Encoding:
Text File  |  1994-04-01  |  10.0 KB  |  320 lines  |  [TEXT/R*ch]

  1. This is a wrapped file. Pipe it through 'unwrap', or edit it by hand:
  2.  lines that begin with -: delete the -
  3.  lines that begin with +: delete the + and append the line to the previous line
  4.  delete all other lines.
  5.  
  6. -HOW TO A CHECK:
  7. -   SHARE map, description, start.objects
  8. -   PUT "" IN more
  9. -   PUT (keys map)union(keys start.objects) IN places
  10. -   FOR mapping IN map:
  11. -      PUT places union mapping IN places
  12. -   FOR place IN places:
  13. -      IF place not.in keys map:
  14. -         A MAP place
  15. -         PUT "yes" IN more
  16. -      IF place not.in keys description:
  17. -         A DESCRIBE place
  18. -         PUT "yes" IN more
  19. -   FOR place IN keys start.objects:
  20. -      FOR object IN start.objects[place]:
  21. -         IF object not.in keys description:
  22. -            A DESCRIBE object
  23. -            PUT "yes" IN more
  24. -   IF more <> "": A CHECK
  25. -
  26. -HOW TO A DELETE place:
  27. -   SHARE map, description
  28. -   IF place in keys description:
  29. -      DELETE description[place]
  30. -   IF place in keys map:
  31. -      DELETE map[place]
  32. -   FOR p IN keys map:
  33. -      FOR d IN keys map[p]:
  34. -         IF map[p][d] = place:
  35. -            DELETE map[p][d]
  36. -            IF map[p] = {}:
  37. -               DELETE map[p]
  38. -
  39. -HOW TO A DESCRIBE place:
  40. -   SHARE description
  41. -   IF place in keys description:
  42. -      WRITE "Already described" /
  43. -      QUIT
  44. -   WRITE "Describe ", place, ":" /
  45. -   A FILL description[place]
  46. -
  47. -HOW TO A FILL message:
  48. -   PUT {} IN message
  49. -   PROMPT '> ' FOR line
  50. -   WHILE line <> ".":
  51. -      PUT line IN message[#message+1]
  52. -      PROMPT '> ' FOR line
  53. -
  54. -HOW TO A MAP place:
  55. -   SHARE map
  56. -   WRITE "Map `place`:" /
  57. -   IF place not.in keys map:
  58. -      PUT {} IN map[place]
  59. -   PROMPT "dirn: " FOR dir
  60. -   WHILE dir <> "":
  61. -      SELECT:
  62. -         dir = "?":
  63. -            WRITE ", " listed all.places /
  64. -         ELSE:
  65. -            PROMPT 'to: ' FOR to
  66. -            IF to <> "":
  67. -               PUT to IN map[place][dir]
  68. -      PROMPT "dirn: " FOR dir
  69. -
  70. -HOW TO A SHOW MAP:
  71. -   SHARE map
  72. -   FOR k IN keys map:
  73. -      WRITE k, ": "/
  74. -      FOR dir IN keys map[k]:
  75. -         WRITE '   ', dir, '->', map[k][dir] /
  76. -
  77. -HOW TO A SYNONYM:
  78. -   SHARE synonyms
  79. -   PROMPT 'original word: ' FOR word
  80. -   WHILE word <> "":
  81. -      IF word not.in keys synonyms: PUT {} IN synonyms[word]
  82. -      PROMPT 'syn: ' FOR syn
  83. -      WHILE syn <> "":
  84. -         IF syn not.in synonyms[word]:
  85. -            INSERT syn IN synonyms[word]
  86. -         PROMPT 'syn: ' FOR syn
  87. -      PROMPT 'original word: ' FOR word
  88. -
  89. -HOW TO ADVENTURE:
  90. -   START
  91. -   GET command
  92. -   WHILE command <> "quit":
  93. -      OBEY command
  94. -      GET command
  95. -   FINISH
  96. -
  97. -HOW TO CAN'T DO verb, object:
  98. -   WRITE "I can't do that!" /
  99. -
  100. -HOW TO DESCRIBE place:
  101. -   SHARE description, visited, objects
  102. -   SELECT:
  103. -      place in visited: WRITE "You're `place`." /
  104. -      ELSE:
  105. -         DISPLAY description[place]
  106. -         INSERT place IN visited
  107. -   FOR object IN objects for place:
  108. -      DISPLAY description[object]
  109. -
  110. -HOW TO DISPLAY message:
  111. -   FOR line IN message:
  112. -      WRITE line /
  113. -
  114. -HOW TO DROP object:
  115. -   SHARE holding, objects, place
  116. -   REMOVE object FROM holding
  117. -   INCLUDE object IN objects FOR place
  118. -
  119. -HOW TO FINISH:
  120. -   WRITE "Bye" /
  121. -
  122. -HOW TO GET command:
  123. -   GET LINE
  124. -   WHILE command = "": GET LINE
  125. -GET LINE:
  126. -   WRITE '> '
  127. -   READ command RAW
  128. -   PUT lower stripped command IN command
  129. -
  130. -HOW TO INCLUDE object IN property FOR thing:
  131. -   IF thing not.in keys property:
  132. -      PUT {} IN property[thing]
  133. -   INSERT object IN property[thing]
  134. -
  135. -HOW TO INVENTORY:
  136. -   SHARE holding
  137. -   WRITE "You are carrying: ", " " listed holding /
  138. -
  139. -HOW TO LOOK object:
  140. -   SHARE visited, place
  141. -   SELECT:
  142. -      object = "":
  143. -         REMOVE place FROM visited
  144. -         DESCRIBE place
  145. -      ELSE:
  146. -         WRITE "I can't." /
  147. -
  148. -HOW TO MOVE TO there:
  149. -   SHARE place
  150. -   PUT there IN place
  151. -   DESCRIBE place
  152. -
  153. -HOW TO OBEY command:
  154. -   SPLIT command INTO verb AND object
  155. -   SELECT:
  156. -      verb = "": PASS
  157. -      special command: TRY TO MOVE command
  158. -      verb = "move": TRY TO MOVE object
  159. -      verb = "take": TRY TO TAKE object
  160. -      verb = "drop": TRY TO DROP object
  161. -      verb = "kill": TRY TO KILL object
  162. -      verb = "what": INVENTORY
  163. -      verb = "look": LOOK object
  164. -      ELSE: CAN'T DO verb, object
  165. -
  166. -HOW TO PROMPT p FOR line:
  167. -   WRITE p
  168. -   READ line RAW
  169. -
  170. -HOW TO SPLIT command INTO verb AND object:
  171. -   SHARE synonyms
  172. -   PUT synonym command IN command
  173. -   PUT split command IN words
  174. -   SELECT:
  175. -      #words = 1: PUT words item 1, "" IN verb, object
  176. -      #words = 2: PUT words item 1, words item 2 IN verb, object
  177. -      ELSE:
  178. -         WRITE "Please use 1 or 2 word sentences." /
  179. -         PUT "", "" IN verb, object
  180. -   PUT synonym verb IN verb
  181. -
  182. -HOW TO START:
  183. -   SHARE place, start.objects, objects, holding, visited
  184. -   PUT "outside the building" IN place
  185. -   PUT start.objects IN objects
  186. -   PUT {} IN holding
  187. -   PUT {} IN visited
  188. -   DESCRIBE place
  189. -
  190. -HOW TO TAKE object:
  191. -   SHARE holding, objects, place
  192. -   REMOVE object FROM objects[place]
  193. -   INSERT object IN holding
  194. -
  195. -HOW TO TRY TO DROP object:
  196. -   SELECT:
  197. -      object = "": WRITE "Which object?" /
  198. -      NOT carrying object: WRITE "You're not carrying it!" /
  199. -      ELSE: DROP object
  200. -
  201. -HOW TO TRY TO KILL object:
  202. -   WRITE "Try to kill", object /
  203. -
  204. -HOW TO TRY TO MOVE direction:
  205. -   SHARE map, place
  206. -   SELECT:
  207. -      direction = "":
  208. -         WRITE "Where to?" /
  209. -      direction in keys map[place]:
  210. -         MOVE TO map[place][direction]
  211. -      ELSE:
  212. -         WRITE "You don't seem to be able to go that way" /
  213. -
  214. -HOW TO TRY TO TAKE object:
  215. -   SHARE holding
  216. -   SELECT:
  217. -      object = "":
  218. -         WRITE "Which object?" /
  219. -      carrying object:
  220. -         WRITE "You're already carrying it!" /
  221. -      NOT present object:
  222. -         WRITE "I see no `object`." /
  223. -      #holding > 6:
  224. -         WRITE "You can't carry any more." /
  225. -      ELSE:
  226. -         TAKE object
  227. -
  228. -HOW TO RETURN all.places:
  229. -   SHARE map
  230. -   PUT keys map IN places
  231. -   FOR mapping IN map:
  232. -      PUT places union mapping IN places
  233. -   RETURN places
  234. -
  235. -HOW TO RETURN synonym verb:
  236. -   SHARE synonyms
  237. -   IF SOME word IN keys synonyms HAS verb in synonyms[word]:
  238. -      RETURN word
  239. -   RETURN verb
  240. -
  241. -HOW TO RETURN property for thing:
  242. -   SELECT:
  243. -      thing in keys property: RETURN property[thing]
  244. -      ELSE: RETURN {}
  245. -
  246. -HOW TO RETURN a less b:
  247. -   FOR x IN b:
  248. -      IF x in a:
  249. -         REMOVE x FROM a
  250. -   RETURN a
  251. -
  252. -HOW TO RETURN sep listed things:
  253. -   PUT "", "" IN list, s
  254. -   FOR thing IN things:
  255. -      PUT list^s^(thing<<1), sep IN list, s
  256. -   RETURN list
  257. -
  258. -HOW TO RETURN a union b:
  259. -   FOR x IN b:
  260. -      IF x not.in a:
  261. -         INSERT x IN a
  262. -   RETURN a
  263. -
  264. -HOW TO REPORT carrying object:
  265. -   SHARE holding
  266. -   REPORT object in holding
  267. -
  268. -HOW TO REPORT present object:
  269. -   SHARE objects, place
  270. -   REPORT object in objects for place
  271. -
  272. -HOW TO REPORT special command:
  273. -   SHARE map, place
  274. -   REPORT command in keys map[place]
  275. -
  276. -PUT {["at the grate"]:{[1]:"You are by a small metal grate fixed into the groun
  277. +d."};["at the open grate"]:{[1]:"You are at a hole in the ground."};["at the sm
  278. +all slit"]:{[1]:"You are at a small slit that the river runs down.";[2]:"A dry 
  279. +river bed carries on ahead."};["at the top of the stairs"]:{[1]:"You are at the
  280. + top of some stairs.";[2]:"Thin whispy mist comes up the stairs from below."};[
  281. +"bird"]:{[1]:"There is a bird here, happily singing."};["cage"]:{[1]:"There is 
  282. +a cage here."};["grate"]:{[1]:"There is a metal grate here."};["in the bird cha
  283. +mber"]:{[1]:"You are in a dark chamber."};["in the dim chamber"]:{[1]:"You are 
  284. +in a dim chamber.";[2]:"To the east glows a dim light.";[3]:"There is an exit t
  285. +o the west."};["in the forest"]:{[1]:"You are in the forest. There are trees al
  286. +l around."};["in the hole"]:{[1]:"You are in a hole dug in the ground.";[2]:"Ab
  287. +ove you, you can see blue sky.";[3]:"A dark tunnel exits to the west."};["insid
  288. +e large hall"]:{[1]:"This is a large hall.";[2]:"There are exits in all directi
  289. +ons."};["inside the building"]:{[1]:"You are inside a building, the well house 
  290. +for a spring."};["keys"]:{[1]:"There are some keys here."};["outside the buildi
  291. +ng"]:{[1]:"You are standing by a building at the end of a road.";[2]:"A spring 
  292. +flows from the building."};["standing by the stream"]:{[1]:"You are standing by
  293. + a stream."}} IN description
  294. -PUT {} IN holding
  295. -PUT {["at the grate"]:{["north"]:"at the small slit";["open grate"]:"at the ope
  296. +n grate"};["at the open grate"]:{["down"]:"in the hole";["north"]:"at the small
  297. + slit"};["at the small slit"]:{["north"]:"standing by the stream";["south"]:"at
  298. + the grate"};["at the top of the stairs"]:{["down"]:"inside large hall";["east"
  299. +]:"in the bird chamber"};["in alcove"]:{["out"]:"in the hall"};["in the bird ch
  300. +amber"]:{["east"]:"in the dim chamber";["west"]:"at the top of the stairs"};["i
  301. +n the dim chamber"]:{["east"]:"in the hole";["west"]:"in the bird chamber"};["i
  302. +n the forest"]:{["east"]:"in the forest";["north"]:"in the forest";["south"]:"i
  303. +n the forest";["west"]:"standing by the stream"};["in the hall"]:{["west"]:"in 
  304. +alcove"};["in the hole"]:{["up"]:"at the open grate";["west"]:"in the dim chamb
  305. +er"};["inside large hall"]:{["up"]:"at the top of the stairs"};["inside the bui
  306. +lding"]:{["out"]:"outside the building"};["outside the building"]:{["in"]:"insi
  307. +de the building";["south"]:"standing by the stream";["west"]:"in the forest"};[
  308. +"standing by the stream"]:{["east"]:"in the forest";["north"]:"outside the buil
  309. +ding";["south"]:"at the small slit";["west"]:"in the forest"}} IN map
  310. -PUT {["at the open grate"]:{"grate"};["at the top of the stairs"]:{"cage"};["in
  311. + the bird chamber"]:{"bird"};["inside the building"]:{"keys"}} IN objects
  312. -PUT "outside the building" IN place
  313. -PUT {["at the open grate"]:{"grate"};["at the top of the stairs"]:{"cage"};["in
  314. + the bird chamber"]:{"bird"};["inside the building"]:{"keys"}} IN start.objects
  315. -PUT {["down"]:{"d"};["east"]:{"e"};["in"]:{"enter"};["look"]:{"where"};["move"]
  316. +:{"go"; "run"; "walk"};["north"]:{"n"};["out"]:{"exit"; "leave"};["south"]:{"s"
  317. +};["up"]:{"u"};["west"]:{"w"}} IN synonyms
  318. -PUT {"outside the building"} IN visited
  319. [[wrap saw 278 lines, 9628 chars, 17651 hashcode]]
  320.