home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-01 | 10.0 KB | 320 lines | [TEXT/R*ch] |
- This is a wrapped file. Pipe it through 'unwrap', or edit it by hand:
- lines that begin with -: delete the -
- lines that begin with +: delete the + and append the line to the previous line
- delete all other lines.
-
- -HOW TO A CHECK:
- - SHARE map, description, start.objects
- - PUT "" IN more
- - PUT (keys map)union(keys start.objects) IN places
- - FOR mapping IN map:
- - PUT places union mapping IN places
- - FOR place IN places:
- - IF place not.in keys map:
- - A MAP place
- - PUT "yes" IN more
- - IF place not.in keys description:
- - A DESCRIBE place
- - PUT "yes" IN more
- - FOR place IN keys start.objects:
- - FOR object IN start.objects[place]:
- - IF object not.in keys description:
- - A DESCRIBE object
- - PUT "yes" IN more
- - IF more <> "": A CHECK
- -
- -HOW TO A DELETE place:
- - SHARE map, description
- - IF place in keys description:
- - DELETE description[place]
- - IF place in keys map:
- - DELETE map[place]
- - FOR p IN keys map:
- - FOR d IN keys map[p]:
- - IF map[p][d] = place:
- - DELETE map[p][d]
- - IF map[p] = {}:
- - DELETE map[p]
- -
- -HOW TO A DESCRIBE place:
- - SHARE description
- - IF place in keys description:
- - WRITE "Already described" /
- - QUIT
- - WRITE "Describe ", place, ":" /
- - A FILL description[place]
- -
- -HOW TO A FILL message:
- - PUT {} IN message
- - PROMPT '> ' FOR line
- - WHILE line <> ".":
- - PUT line IN message[#message+1]
- - PROMPT '> ' FOR line
- -
- -HOW TO A MAP place:
- - SHARE map
- - WRITE "Map `place`:" /
- - IF place not.in keys map:
- - PUT {} IN map[place]
- - PROMPT "dirn: " FOR dir
- - WHILE dir <> "":
- - SELECT:
- - dir = "?":
- - WRITE ", " listed all.places /
- - ELSE:
- - PROMPT 'to: ' FOR to
- - IF to <> "":
- - PUT to IN map[place][dir]
- - PROMPT "dirn: " FOR dir
- -
- -HOW TO A SHOW MAP:
- - SHARE map
- - FOR k IN keys map:
- - WRITE k, ": "/
- - FOR dir IN keys map[k]:
- - WRITE ' ', dir, '->', map[k][dir] /
- -
- -HOW TO A SYNONYM:
- - SHARE synonyms
- - PROMPT 'original word: ' FOR word
- - WHILE word <> "":
- - IF word not.in keys synonyms: PUT {} IN synonyms[word]
- - PROMPT 'syn: ' FOR syn
- - WHILE syn <> "":
- - IF syn not.in synonyms[word]:
- - INSERT syn IN synonyms[word]
- - PROMPT 'syn: ' FOR syn
- - PROMPT 'original word: ' FOR word
- -
- -HOW TO ADVENTURE:
- - START
- - GET command
- - WHILE command <> "quit":
- - OBEY command
- - GET command
- - FINISH
- -
- -HOW TO CAN'T DO verb, object:
- - WRITE "I can't do that!" /
- -
- -HOW TO DESCRIBE place:
- - SHARE description, visited, objects
- - SELECT:
- - place in visited: WRITE "You're `place`." /
- - ELSE:
- - DISPLAY description[place]
- - INSERT place IN visited
- - FOR object IN objects for place:
- - DISPLAY description[object]
- -
- -HOW TO DISPLAY message:
- - FOR line IN message:
- - WRITE line /
- -
- -HOW TO DROP object:
- - SHARE holding, objects, place
- - REMOVE object FROM holding
- - INCLUDE object IN objects FOR place
- -
- -HOW TO FINISH:
- - WRITE "Bye" /
- -
- -HOW TO GET command:
- - GET LINE
- - WHILE command = "": GET LINE
- -GET LINE:
- - WRITE '> '
- - READ command RAW
- - PUT lower stripped command IN command
- -
- -HOW TO INCLUDE object IN property FOR thing:
- - IF thing not.in keys property:
- - PUT {} IN property[thing]
- - INSERT object IN property[thing]
- -
- -HOW TO INVENTORY:
- - SHARE holding
- - WRITE "You are carrying: ", " " listed holding /
- -
- -HOW TO LOOK object:
- - SHARE visited, place
- - SELECT:
- - object = "":
- - REMOVE place FROM visited
- - DESCRIBE place
- - ELSE:
- - WRITE "I can't." /
- -
- -HOW TO MOVE TO there:
- - SHARE place
- - PUT there IN place
- - DESCRIBE place
- -
- -HOW TO OBEY command:
- - SPLIT command INTO verb AND object
- - SELECT:
- - verb = "": PASS
- - special command: TRY TO MOVE command
- - verb = "move": TRY TO MOVE object
- - verb = "take": TRY TO TAKE object
- - verb = "drop": TRY TO DROP object
- - verb = "kill": TRY TO KILL object
- - verb = "what": INVENTORY
- - verb = "look": LOOK object
- - ELSE: CAN'T DO verb, object
- -
- -HOW TO PROMPT p FOR line:
- - WRITE p
- - READ line RAW
- -
- -HOW TO SPLIT command INTO verb AND object:
- - SHARE synonyms
- - PUT synonym command IN command
- - PUT split command IN words
- - SELECT:
- - #words = 1: PUT words item 1, "" IN verb, object
- - #words = 2: PUT words item 1, words item 2 IN verb, object
- - ELSE:
- - WRITE "Please use 1 or 2 word sentences." /
- - PUT "", "" IN verb, object
- - PUT synonym verb IN verb
- -
- -HOW TO START:
- - SHARE place, start.objects, objects, holding, visited
- - PUT "outside the building" IN place
- - PUT start.objects IN objects
- - PUT {} IN holding
- - PUT {} IN visited
- - DESCRIBE place
- -
- -HOW TO TAKE object:
- - SHARE holding, objects, place
- - REMOVE object FROM objects[place]
- - INSERT object IN holding
- -
- -HOW TO TRY TO DROP object:
- - SELECT:
- - object = "": WRITE "Which object?" /
- - NOT carrying object: WRITE "You're not carrying it!" /
- - ELSE: DROP object
- -
- -HOW TO TRY TO KILL object:
- - WRITE "Try to kill", object /
- -
- -HOW TO TRY TO MOVE direction:
- - SHARE map, place
- - SELECT:
- - direction = "":
- - WRITE "Where to?" /
- - direction in keys map[place]:
- - MOVE TO map[place][direction]
- - ELSE:
- - WRITE "You don't seem to be able to go that way" /
- -
- -HOW TO TRY TO TAKE object:
- - SHARE holding
- - SELECT:
- - object = "":
- - WRITE "Which object?" /
- - carrying object:
- - WRITE "You're already carrying it!" /
- - NOT present object:
- - WRITE "I see no `object`." /
- - #holding > 6:
- - WRITE "You can't carry any more." /
- - ELSE:
- - TAKE object
- -
- -HOW TO RETURN all.places:
- - SHARE map
- - PUT keys map IN places
- - FOR mapping IN map:
- - PUT places union mapping IN places
- - RETURN places
- -
- -HOW TO RETURN synonym verb:
- - SHARE synonyms
- - IF SOME word IN keys synonyms HAS verb in synonyms[word]:
- - RETURN word
- - RETURN verb
- -
- -HOW TO RETURN property for thing:
- - SELECT:
- - thing in keys property: RETURN property[thing]
- - ELSE: RETURN {}
- -
- -HOW TO RETURN a less b:
- - FOR x IN b:
- - IF x in a:
- - REMOVE x FROM a
- - RETURN a
- -
- -HOW TO RETURN sep listed things:
- - PUT "", "" IN list, s
- - FOR thing IN things:
- - PUT list^s^(thing<<1), sep IN list, s
- - RETURN list
- -
- -HOW TO RETURN a union b:
- - FOR x IN b:
- - IF x not.in a:
- - INSERT x IN a
- - RETURN a
- -
- -HOW TO REPORT carrying object:
- - SHARE holding
- - REPORT object in holding
- -
- -HOW TO REPORT present object:
- - SHARE objects, place
- - REPORT object in objects for place
- -
- -HOW TO REPORT special command:
- - SHARE map, place
- - REPORT command in keys map[place]
- -
- -PUT {["at the grate"]:{[1]:"You are by a small metal grate fixed into the groun
- +d."};["at the open grate"]:{[1]:"You are at a hole in the ground."};["at the sm
- +all slit"]:{[1]:"You are at a small slit that the river runs down.";[2]:"A dry
- +river bed carries on ahead."};["at the top of the stairs"]:{[1]:"You are at the
- + top of some stairs.";[2]:"Thin whispy mist comes up the stairs from below."};[
- +"bird"]:{[1]:"There is a bird here, happily singing."};["cage"]:{[1]:"There is
- +a cage here."};["grate"]:{[1]:"There is a metal grate here."};["in the bird cha
- +mber"]:{[1]:"You are in a dark chamber."};["in the dim chamber"]:{[1]:"You are
- +in a dim chamber.";[2]:"To the east glows a dim light.";[3]:"There is an exit t
- +o the west."};["in the forest"]:{[1]:"You are in the forest. There are trees al
- +l around."};["in the hole"]:{[1]:"You are in a hole dug in the ground.";[2]:"Ab
- +ove you, you can see blue sky.";[3]:"A dark tunnel exits to the west."};["insid
- +e large hall"]:{[1]:"This is a large hall.";[2]:"There are exits in all directi
- +ons."};["inside the building"]:{[1]:"You are inside a building, the well house
- +for a spring."};["keys"]:{[1]:"There are some keys here."};["outside the buildi
- +ng"]:{[1]:"You are standing by a building at the end of a road.";[2]:"A spring
- +flows from the building."};["standing by the stream"]:{[1]:"You are standing by
- + a stream."}} IN description
- -PUT {} IN holding
- -PUT {["at the grate"]:{["north"]:"at the small slit";["open grate"]:"at the ope
- +n grate"};["at the open grate"]:{["down"]:"in the hole";["north"]:"at the small
- + slit"};["at the small slit"]:{["north"]:"standing by the stream";["south"]:"at
- + the grate"};["at the top of the stairs"]:{["down"]:"inside large hall";["east"
- +]:"in the bird chamber"};["in alcove"]:{["out"]:"in the hall"};["in the bird ch
- +amber"]:{["east"]:"in the dim chamber";["west"]:"at the top of the stairs"};["i
- +n the dim chamber"]:{["east"]:"in the hole";["west"]:"in the bird chamber"};["i
- +n the forest"]:{["east"]:"in the forest";["north"]:"in the forest";["south"]:"i
- +n the forest";["west"]:"standing by the stream"};["in the hall"]:{["west"]:"in
- +alcove"};["in the hole"]:{["up"]:"at the open grate";["west"]:"in the dim chamb
- +er"};["inside large hall"]:{["up"]:"at the top of the stairs"};["inside the bui
- +lding"]:{["out"]:"outside the building"};["outside the building"]:{["in"]:"insi
- +de the building";["south"]:"standing by the stream";["west"]:"in the forest"};[
- +"standing by the stream"]:{["east"]:"in the forest";["north"]:"outside the buil
- +ding";["south"]:"at the small slit";["west"]:"in the forest"}} IN map
- -PUT {["at the open grate"]:{"grate"};["at the top of the stairs"]:{"cage"};["in
- + the bird chamber"]:{"bird"};["inside the building"]:{"keys"}} IN objects
- -PUT "outside the building" IN place
- -PUT {["at the open grate"]:{"grate"};["at the top of the stairs"]:{"cage"};["in
- + the bird chamber"]:{"bird"};["inside the building"]:{"keys"}} IN start.objects
- -PUT {["down"]:{"d"};["east"]:{"e"};["in"]:{"enter"};["look"]:{"where"};["move"]
- +:{"go"; "run"; "walk"};["north"]:{"n"};["out"]:{"exit"; "leave"};["south"]:{"s"
- +};["up"]:{"u"};["west"]:{"w"}} IN synonyms
- -PUT {"outside the building"} IN visited
- [[wrap saw 278 lines, 9628 chars, 17651 hashcode]]
-