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 ground."};["at the open grate"]:{[1]:"You are at a hole in the ground."};["at the small 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 chamber"]:{[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 to the west."};["in the forest"]:{[1]:"You are in the forest. There are trees all around."};["in the hole"]:{[1]:"You are in a hole dug in the ground.";[2]:"Above you, you can see blue sky.";[3]:"A dark tunnel exits to the west."};["inside large hall"]:{[1]:"This is a large hall.";[2]:"There are exits in all directions."};["inside the building"]:{[1]:"You are inside a building, the well house for a spring."};["keys"]:{[1]:"There are some keys here."};["outside the building"]:{[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 open 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 chamber"]:{["east"]:"in the dim chamber";["west"]:"at the top of the stairs"};["in the dim chamber"]:{["east"]:"in the hole";["west"]:"in the bird chamber"};["in the forest"]:{["east"]:"in the forest";["north"]:"in the forest";["south"]:"in 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 chamber"};["inside large hall"]:{["up"]:"at the top of the stairs"};["inside the building"]:{["out"]:"outside the building"};["outside the building"]:{["in"]:"inside the building";["south"]:"standing by the stream";["west"]:"in the forest"};["standing by the stream"]:{["east"]:"in the forest";["north"]:"outside the building";["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