Hadean Lands: Ritual Testing

Copyright 2014-6 by Andrew Plotkin.

This source code is provided for personal, educational use only. The story and text of Hadean Lands belong to me; you may not use them or create derivative works which contain them. However, you have permission to use the programming techniques of this game in your own works, and you may use the source code excluding game text.



"Ritual Testing" by Andrew Plotkin.
[IFID:16d5169c-0330-4224-9fff-ba6b210fff80]
 
Use MAX_DICT_ENTRIES of 3000.
Use MAX_OBJECTS of 1000;
Use MAX_PROP_TABLE_SIZE of 500000.
Use OMIT_UNUSED_ROUTINES of 1.
 
Include HL Mechanism by Andrew Plotkin.
Include HL Ritual by Andrew Plotkin.
Include HL Gen Goals by Andrew Plotkin.
 
 
Chapter - Testing Setup
 
The initial awakening banner rule is not listed in any rulebook. [Skip the fancy intro line.]
 
Reset rule (this is the reset object locations rule):
    now the player carries the brass-pin;
    now the player carries the steel-bolt;
    now the player carries the glass-loop;
    now the player carries the convex-lens;
    now the player carries the concave-lens;
    now the player carries the mushroom;
    now the player carries the rosemary;
    now the player carries the honeysuckle;
    now the player carries the mustard;
    now the player carries the zafranum;
    now the player carries the pinecone;
    now the player carries the feather;
    now the player carries the rock-salt;
    now the player carries the fluorite;
    now the player carries the long-quartz;
    now the player carries the broad-quartz;
    now the player carries the rough-diamond;
    now the player carries the jade;
    now the player carries the scratched-bubble;
    now all chem-sources are carried by the player;
    now all chimes are carried by the player;
    now all pebbles are carried by the player;
    now all wood-splints are carried by the player;
    now all metal-rods are carried by the player;
    now all clay-molds are carried by the player;
    now the player carries the iron-bead;
    now the player carries the mercury;
    now the player carries the el-water;
    now the player carries the el-earth;
    now the player carries the silver-chain;
    now the player carries the silk-cord;
    now the player carries the paten;
    now the player carries the labyrinth-tile;
    now the player carries the scalpel;
    now the player carries the torch-lighter;
    repeat with P running through chem-vials:
        now P is off-stage;
    repeat with P running through metal-seals:
        now P is off-stage;
    now the gold-rod is off-stage;
    now the phlo-electrum is off-stage;
    now the gold-amalgam is off-stage;
    now the red-amalgam is off-stage;
    now the white-amalgam is off-stage;
    now the whitgold-rod is off-stage;
    now the moongold-rod is off-stage;
    now the ring-gold-rod is off-stage;
    now the nonexistent-stone is off-stage;
    now the baros-key is off-stage;
    now all impets are on the butcher-block;
    now the brass-pyramid is in the Kitchen;
    now the fake-tin-slip is in the Kitchen;
 
The reset the player's situation rule is listed after the reset visited and handled rule in the reset rulebook.
Reset rule (this is the reset the player's situation rule):
    move the player to the Kitchen, without printing a room description;
    now the Abstraction Layer is not visited.
 
When play begins:
    now all formulas are known;
    now the no-word is unknown;
    repeat with F running through known formulas:
        mark F as known;
    now all action-goals are ever-done;
    repeat with G running through recallable ever-done action-goals:
        mark G as done. [ensure it's in known-rituals]
 
To recite post-reset text:
    do nothing.
 
To decide whether escaped first room:
    decide yes.
 
To say epigraph (N - number):
    do nothing.
 
To decide what object is the wire-bound-basis of (B - ritual-bound):
    decide on nothing.
 
To uncover the el-earth:
    [Invoked by HL Mechanism, but only when the el-earth is part of something, which won't occur in this test game.]
    say "(BUG) Uncover the el-earth?"
 
To decide whether alien aither nearby:
    [Invoked by HL Mechanism, to tune the response for drinking the aither-protection.]
    decide no.
 
To decide whether nickel-filings-accessible:
    [Invoked by HL Gen Goals, to decide which nickel to go for. (Only called if the nickel-filings is ever-seen.)]
    if the nickel-filings is on-stage:
        decide yes.
 
To say the recalled-description of (C - character) present (PF - truth state):
    say "Description of [C]."
 
To say the oc-message-basic for (C - character):
    say "Oculus text of [C]."
To say the oc-message-final for (C - character):
    say "Oculus text of [C]."
 
The player carries a magic wand. The wand is a takeable-thing.
The player carries some magic beans. The beans are a takeable-thing.
Understand "major" as the beans.
 
The brass-pyramid is a takeable-thing. The brass-pyramid is in the Kitchen. The printed name is "brass pyramid".
Understand "brass", "pyramid" as the brass-pyramid.
The brass-pyramid has a descriptor-type. The descriptor-type of the brass-pyramid is brass-descriptor.
 
Check tapping the brass-pin on the wand when the symbol-type of the brass-pin is some-saturation-symbol:
    instead say "The wand is utterly unaffected by the [symbol-type of the brass-pin] symbol."
 
Check tapping the steel-bolt on the wand when the symbol-type of the steel-bolt is some-saturation-symbol:
    instead say "The wand is absolutely unaffected by the [symbol-type of the steel-bolt] symbol."
 
The player carries the env-dial.
Understand "env", "dial" as the env-dial.
The env-dial has a ritual-env called the env.
The env-dial is a readable takeable-thing.
The description of the env-dial is "The dial is set to [the env of the env-dial]."
 
To decide what ritual-env is the debug-override-env:
    decide on the env of env-dial.
 
Understand "set [env-dial] to [ritual-env]" as env-setting it to.
Understand "zap [env-dial] to [ritual-env]" as env-setting it to.
 
Check setting the env-dial to:
    instead say "Available environments: [list of ritual-env]."
Check env-setting the env-dial to:
    now the env of the env-dial is the ritual-env understood;
    instead say "You set the dial to [the env of the env-dial]; it turns [color of the env of the env-dial]."
 
Check shaking the env-dial:
    if the kitchen-bound is normal-bound-level:
        now the kitchen-bound is nave-bound-level;
    else if the kitchen-bound is nave-bound-level:
        now the kitchen-bound is chancel-bound-level;
    else:
        now the kitchen-bound is normal-bound-level;
    instead say "You shake the dial; [the kitchen-bound] is now [ritual-bound condition of the kitchen-bound]."
 
 
Section - Assorted Falsework
 
The fake-tin-slip is a symbolish takeable-thing in the Kitchen. The printed name is "fake tin slip".
The fake-tin-slip has a number called the correctness.
The description is "The tin slip is [if the correctness of the fake-tin-slip is 0]blank[else if the correctness of the fake-tin-slip is 1]ruined[else if the correctness of the fake-tin-slip is 2]wrong[else]right[end if]."
Understand "tin", "slip" as the fake-tin-slip.
 
Check touching the fake-tin-slip:
    say "You tap the tin. ";
    increment the correctness of the fake-tin-slip;
    if the correctness of the fake-tin-slip is 4:
        now correctness of the fake-tin-slip is 0;
    instead say "[the description of the fake-tin-slip][br]".
 
Definition: a thing is tin-slip rather than non-tin-slip if it is the fake-tin-slip.
To decide what number is the tin-slip-correctness of (T - thing):
    if T is not the fake-tin-slip:
        decide on 0;
    decide on the correctness of the fake-tin-slip.
 
The generic-ritual-location is an undescribed action-goal. The short-description is "reach a ritual bound".
Goal prereqs rule for generic-ritual-location:
    [In the real game, this should try to visit whichever bound is closest.]
    require-or-fail the Kitchen;
    rule succeeds.
 
The nave-ritual-location is an undescribed action-goal. The short-description is "reach a nave-like ritual bound".
Goal prereqs rule for nave-ritual-location:
    require-or-fail the Kitchen;
    rule succeeds.
 
The chancel-ritual-location is an undescribed action-goal. The short-description is "reach a chancel-like ritual bound".
Goal prereqs rule for chancel-ritual-location:
    require-or-fail the Kitchen;
    rule succeeds.
 
The chymic-ritual-location is an undescribed action-goal. The short-description is "reach the retort".
Goal prereqs rule for chymic-ritual-location:
    require-or-fail the Chem-Test-Room;
    rule succeeds.
 
The create-ritual-env-goal is an ever-done reentrant action-goal. The short-description is "fake an appropriate environment".
The create-ritual-env-goal has a ritual-env called the goal-env.
The create-ritual-env-goal has a thing called the goal-env-tool.
Goal prereqs rule for create-ritual-env-goal:
    let E be the goal-env of create-ritual-env-goal;
    now the goal-env-tool of create-ritual-env-goal is no-thing;
    now the env of the env-dial is E;
    say "You set the dial to [E].";
    rule succeeds.
 
[The ignite-goal is an action-goal. The short-description is "set something on fire".]
The ignite-goal has a truth state called the auto-drop-lighter.
Goal prereqs rule for ignite-goal:
    [In the real game, this should try to find some cedar and then reach a fire source.]
    rule succeeds.
 
To special-case zap-see (G - object):
    do nothing.
 
The steel-bolt can be discovered or undiscovered. The steel-bolt is discovered.
 
[So that "find mustard" doesn't produce a runtime error.]
The mustard-supply is in the Abstraction Layer.
 
The dup-ritual-fact is a tidbit. The description is "[now-ever-used dup-ritual-fact]Blinovna Limitation Effect!"
The dup-ritual-fact can be ever-used.
Understand "blinovna", "limitation" as dup-ritual-fact.
 
To skip certain objects for listing in recall:
    do nothing.
 
To mark the location as spark-checked:
    say "(DEBUG) [The location] is spark-checked."
 
To recite the spark-unchecked rooms:
    do nothing.
 
Definition: a room is dragon-nested if it is the Maze-Start.
 
To complete initial marriage:
    now the great-marriage is homunc-done;
    say "(DEBUG) The initial marriage is complete."
 
To decide whether chapter-1-done:
    yes.
 
To complete the game proper with ballast (N - number):
    say "(DEBUG) The game proper is complete ([N])."
 
To decide whether post-game:
    no.
 
Definition: a room is ballast-appropriate if it is the Maze-Start.
 
A dragon is a kind of thing.
The no-dragon is a dragon.
The active-dragon is a dragon that varies. Active-dragon is no-dragon.
To decide what dragon is the current-mobile-dragon:
    decide on no-dragon.
To say color of current-mobile-dragon:
    say "pink".
 
To decide what number is the dead-dragon-count: decide on -1.
 
To mobilize active dragon dir (seq - formula):
    say "(DEBUG) The active dragon has been mobilized with [the seq]."
 
 
Section - Test Labs
 
The Kitchen is a recallable room. "You are in the kitchen. The Pool is down, the Dome Set is up, the Moon is south (also southwest and southeast), the Chem Lab is north, the Furnace Room is east, the Machine Shop is northeast. The Maze begins to the west."
The aroma-description is "The room smells pleasantly of cookies[aroma-addendum]".
 
The butcher-block is a scenery supporter in the Kitchen.
Understand "butcher", "block" as the butcher-block.
 
The stand-mixer is scenery in the Kitchen.
Understand "stand", "mixer" as the stand-mixer.
Check shaking the stand-mixer:
    instead say "You rattle the stand mixer, but it's bolted down."
 
The kitchen-bound is a ritual-bound in the Kitchen.
The short-adjective is "kitchen bound".
The description is "This bound is used for delightful pastry spells."
 
The kitchen-shelf is a ritual-shelf in the Kitchen.
The linked-shelf of the kitchen-bound is the kitchen-shelf.
 
The pool is scenery in the Kitchen.
 
The drop-stuff-in-pool rule is listed after the better can't insert what's not held rule in the check inserting it into rulebook.
Check inserting a takeable-thing into the pool (this is the drop-stuff-in-pool rule):
    perform throw moisturization with the noun in Pool-Test-Room;
    stop the action.
 
Check entering the pool:
    instead try going down.
 
Check searching the pool:
    instead say "You peer into the depths."
 
The Chem-Test-Room is north of the Kitchen. The printed name is "Chem Lab".
The Chem-Test-Room is recallable. Understand "chem", "lab" as the Chem-Test-Room .
 
The retort is in the Chem-Test-Room.
 
 
The Furnace-Test-Room is east of the Kitchen. The printed name is "Furnace Room".
 
The hearth is scenery in the Furnace-Test-Room.
The hearth is alight. It burns at 15.
Understand "fire", "flame" as the hearth when the hearth is alight.
Check entering the hearth:
    if currently fireproof:
        instead say "Yes, you're fireproof, but the hearth still isn't big enough to crawl into.";
    instead say "You do not wish to broil yourself."
 
The safety-candle is in the Furnace-Test-Room. The printed name is "safety candle[if alight] (alight)[end if]".
It burns at 12.
The description is "The safety candle has a flame-point of [flame-point] degrees[if alight]. It is burning[end if]."
Understand "safety", "candle" as the safety-candle.
Understand "fire", "flame" as the safety-candle when the safety-candle is alight.
 
Understand "set [safety-candle] to [number]" as num-setting it to.
Understand "zap [safety-candle] to [number]" as num-setting it to.
 
Check num-setting the safety-candle to:
    now the safety-candle burns at the number understood;
    say "The safety candle now burns at [flame-point of the safety-candle] degrees."
 
The safety-cabinet is a closed openable fixed in place container in the Furnace-Test-Room.
Understand "cabinet" as the safety-cabinet.
 
The hot-candle is a takeable-thing in the safety-cabinet.  The printed name is "hot candle[if alight] (alight)[end if]".
It burns at 25. It is alight.
Understand "hot", "candle" as the hot-candle.
Understand "fire", "flame" as the hot-candle when the hot-candle is alight.
 
The thermosensor is a takeable-thing in the Furnace-Test-Room.
Understand "sensor" as the thermosensor.
Check igniting the thermosensor with:
    instead say "The thermosensor shows that [the second noun] burns at [flame-point of second noun] degrees."
 
The cedar-supply is in the Furnace-Test-Room.
 
 
The Kiln-Test-Room is east of the Furnace-Test-Room. The printed name is "Kiln Room".
 
The kiln is in the Kiln-Test-Room.
The kiln-burner is in the Kiln-Test-Room.
 
The crock is in the Kiln-Test-Room.
 
The camphrost-supply is in the Kiln-Test-Room.
 
The Fiery-Test-Room is south of the Furnace-Test-Room.
The atmosphere of Fiery-Test-Room is fire-atm.
The fiery-test-fire is scenery in the Fiery-Test-Room. It burns at 15. The fiery-test-fire is alight.
Understand "inferno" as the fiery-test-fire.
 
Check going south from the Furnace-Test-Room:
    if not currently fireproof:
        instead say "The fierce heat drives you back.";
    [### this first-time should be resettable ]
    say "You step into the flames, which feel like a warm breeze on your skin[first time]. Your Marcher uniform, woven with alchemical virtues to resist this sort of mistreatment, only scorches slightly[only].";
    perform inventory incineration in fiery-test-fire.
 
 
The Moon-Test-Room is south of the Kitchen. The printed name is "The Moon". The refer-name is "the Moon". The refer-preposition is "on".
The atmosphere of Moon-Test-Room is vacuum-atm.
 
For room-visiting the Moon-Test-Room:
    say "Your vacuum alarm rings once, and then you can't hear it any more."
 
Check going south from the Kitchen:
    [### if not vacuum-protected, die.]
    say "The vacuum plucks at your clothing for a moment[first time], but the only other sensation is a nagging dryness in your sinuses. Very strange[only].";
    perform inventory vacuumization in the Moon-Test-Room.
 
Check going up from the Kitchen when the atmosphere of the Dome-Set-Room is vacuum-atm:
    [### if not vacuum-protected, die.]
    say "The vacuum plucks at your clothing for a moment[first time], but the only other sensation is a nagging dryness in your sinuses. Very strange[only].";
    perform inventory vacuumization in the Dome-Set-Room.
 
 
The Dome-Set-Room is above the Kitchen. The printed name is "Dome Set".
 
The dome-valve is scenery in the Dome-Set-Room. The printed name is "valve wheel".
Understand "valve", "wheel" as the dome-valve.
 
The dome-table is a scenery supporter in the Dome-Set-Room.
Understand "table" as the dome-table.
The dome-crate is a scenery container in the Dome-Set-Room.
Understand "crate" as the dome-crate.
 
Check turning the dome-valve:
    if the atmosphere of the Dome-Set-Room is vacuum-atm:
        now the atmosphere of the Dome-Set-Room is normal-atm;
        instead say "Air whooshes back into the dome.";
    else:
        now the atmosphere of the Dome-Set-Room is vacuum-atm;
        say "Air whooshes out of the dome.";
        perform room vacuumization in the Dome-Set-Room;
        stop the action.
 
 
The Pool-Test-Room is below the Kitchen. The printed name is "In the Pool". The refer-name is "the Pool".
The atmosphere of Pool-Test-Room is water-atm.
Understand "room" as Pool-Test-Room.
 
The pool-test-water is a room-proxy in the Pool-Test-Room.
Understand "pool", "water" as the pool-test-water.
 
Check going down from the Kitchen:
    begin underwater activity;
    perform inventory moisturization in Pool-Test-Room.
 
Check going up from the Pool-Test-Room:
    cease underwater activity.
 
Check going outside in the Pool-Test-Room:
    instead try going up.
 
The Machine-Test-Room is northeast of the Kitchen. The printed name is "Machine Shop".
The Machine-Test-Room is recallable.
Understand "machine", "shop" as the Machine-Test-Room.
 
To decide what object is the current toolshop destination:
    decide on Machine-Test-Room.
To decide what room is the current toolshop location:
    decide on Machine-Test-Room.
 
The wire-drawer is in the Machine-Test-Room.
The wire-splicer is in the Machine-Test-Room.
The aeroclave is in the Machine-Test-Room.
The air-tank is in the Machine-Test-Room.
The miasma-gong is in the Machine-Test-Room.
 
To decide whether near-aura-cloud: decide no. [only in real game]
 
The Forbidden Zone is northwest of the Kitchen.
 
Check going southwest in the Kitchen:
    instead try going south.
 
Instead of going southeast in the Kitchen:
    instead try going south.
 
Check going northwest from the Kitchen:
    [the ritual-stopping rule still runs]
    instead say "That's forbidden."
 
Section - The Maze
 
The home-testzone is a room-goal. The canon-room is the Kitchen.
The zone of the Kitchen is home-testzone.
The zone of the Chem-Test-Room is home-testzone.
The zone of the Machine-Test-Room is home-testzone.
The zone of the Furnace-Test-Room is home-testzone.
The zone of the Kiln-Test-Room is home-testzone.
 
Zone step rule for home-testzone:
    let targetzone be the zone-step-target of goalstate;
    rule succeeds with result alpha-testzone.
 
Maze-Start is a visited recallable room.
The start-testzone is a room-goal. The zone of Maze-Start is start-testzone.
Maze-Start is west of the Kitchen.
Understand "start", "maze" as Maze-Start.
 
The test-Captain is a character in Maze-Start. The persona of the test-Captain is Captain.
Understand "captain" as the test-Captain.
 
Zone step rule for start-testzone:
    let targetzone be the zone-step-target of goalstate;
    if targetzone is home-testzone:
        rule succeeds with result home-testzone;
    if targetzone is iota-testzone:
        if iota-door is closed:
            require-or-fail the iota-door-goal;
        rule succeeds with result iota-testzone;
    if targetzone is alpha-testzone or targetzone is beta-testzone or targetzone is gamma-testzone or targetzone is delta-testzone:
        rule succeeds with result alpha-testzone;
    say "### start-testzone step rule: don't know how to step towards [targetzone].";
    rule fails;
 
Maze-Alpha is a visited recallable room.
The alpha-testzone is a room-goal. The zone of Maze-Alpha is alpha-testzone.
Maze-Alpha is south of Maze-Start.
Understand "alpha", "maze" as Maze-Alpha.
The green alpha is a takeable-thing in Maze-Alpha.
The phaser is an ever-seen takeable-thing in Maze-Alpha.
The stretch-switch is a scenery device in Maze-Alpha.
 
Zone step rule for alpha-testzone:
    let targetzone be the zone-step-target of goalstate;
    if targetzone is home-testzone or targetzone is start-testzone or targetzone is iota-testzone:
        rule succeeds with result start-testzone;
    if targetzone is beta-testzone or targetzone is delta-testzone:
        if beta-door is closed:
            require-or-fail the beta-door-goal;
        rule succeeds with result beta-testzone;
    if targetzone is gamma-testzone:
        if gamma-door is closed:
            require-or-fail the gamma-door-goal;
        rule succeeds with result gamma-testzone;
    say "### alpha-testzone step rule: don't know how to step towards [targetzone].";
    rule fails.
 
Maze-Pit is a visited recallable room.
The near-zone-room is Maze-Alpha.
Maze-Pit is below Maze-Alpha.
 
The pitrock is an ever-seen takeable-thing in Maze-Pit.
 
The maze-pit-stretch rule is listed before the give-up-on-stretch pickup rule in the goal pickup rules.
Goal pickup rule for a thing (called G) when the pickup-stretch-room of goalstate is Maze-Pit and the pickup-room of goalstate is Maze-Alpha and the stretch-switch is switched on (this is the maze-pit-stretch rule):
    if goalstate is not hypothetical:
        say "You reach down into the pit and snag [the G].";
        now the player carries G;
    rule succeeds.
 
Maze-Attic is a visited recallable room.
Maze-Attic is above Maze-Alpha.
 
Maze-Beta is a visited recallable room.
The beta-testzone is a room-goal. The zone of Maze-Beta is beta-testzone.
Understand "beta", "maze" as Maze-Beta.
 
The beta-alien is in Maze-Beta. Understand "beta", "alien" as the beta-alien.
 
The beta-door is a closed door. "The beta-door is [if closed]closed[else]open[end if]."
The beta-door is south of Maze-Alpha and north of Maze-Beta.
Understand "beta", "door" as beta-door.
Carry out opening beta-door:
    now beta-door-goal is ever-done.
 
The beta-door-goal is an action-goal. The short-description is "open the beta-door".
Goal prereqs rule for beta-door-goal:
    [this is only called from alpha or beta, so we don't require a location.]
    if goalstate is not hypothetical:
        say "You open the beta-door.";
        now the beta-door is open;
    [succeed whether hypothetical or not, because this action is always possible]
    rule succeeds.
 
The beta-alien-goal is an action-goal. The short-description is "zap the beta-alien".
Goal prereqs rule for beta-alien-goal:
    require-or-fail the phaser;
    if goalstate is not hypothetical:
        say "You shot the alien!";
        now the beta-alien is off-stage;
    rule succeeds.
 
Zone step rule for beta-testzone:
    let targetzone be the zone-step-target of goalstate;
    if targetzone is delta-testzone:
        if the beta-alien is in Maze-Beta:
            require-or-fail the beta-alien-goal;
        rule succeeds with result delta-testzone;
    [all other directions are out]
    if beta-door is closed:
        require-or-fail the beta-door-goal;
    rule succeeds with result alpha-testzone.
 
Maze-Delta is a visited recallable room. Maze-Delta is west of Maze-Beta.
The delta-testzone is a room-goal. The zone of Maze-Delta is delta-testzone.
Understand "delta", "maze" as Maze-Delta.
 
The delta-table is a scenery supporter in Maze-Delta.
 
Zone step rule for delta-testzone:
    let targetzone be the zone-step-target of goalstate;
    [all directions are out]
    rule succeeds with result alpha-testzone.
 
Maze-Gamma is a visited recallable room.
The gamma-testzone is a room-goal. The zone of Maze-Gamma is gamma-testzone.
Understand "gamma", "maze" as Maze-Gamma.
 
The gamma-door is a closed door. "The gamma-door is [if closed]closed[else]open[end if]."
The gamma-door is southeast of Maze-Alpha and northwest of Maze-Gamma.
Understand "gamma", "door" as gamma-door.
Carry out opening gamma-door:
    now gamma-door-goal is ever-done.
 
The gamma-door-goal is an action-goal. The short-description is "open the gamma-door".
 
Goal prereqs rule for gamma-door-goal:
    [this is only called from alpha or gamma, so we don't require a location.]
    if goalstate is not hypothetical:
        say "The gamma-door is closed, and so it frustrates you.";
    rule fails.
 
Zone step rule for gamma-testzone:
    let targetzone be the zone-step-target of goalstate;
    [all directions are out]
    if gamma-door is closed:
        require-or-fail the gamma-door-goal;
    rule succeeds with result alpha-testzone.
 
Maze-Iota is a visited recallable room.
The iota-testzone is a room-goal. The zone of Maze-Iota is iota-testzone.
Understand "iota", "maze" as Maze-Iota.
 
The iota-door is a closed door. "The iota-door is [if closed]closed[else]open[end if]."
The iota-door is west of Maze-Start and east of Maze-Iota.
Understand "iota", "door" as iota-door.
Carry out opening iota-door:
    now iota-door-goal is ever-done.
 
The ionizer is an ever-seen takeable-thing. The creation-action of the ionizer is the ionizer-create-goal.
The ion-widget is an ever-seen takeable-thing in Maze-Start. The printed name is "ion widget".
Understand "ion", "widget" as the ion-widget.
 
The ionizer-create-goal is a recallable action-goal.  The short-description is "create the ionizer". The description is "You know how to build an ionizer out of a lead rod, fluorite, and an ion widget."
 
Goal prereqs rule for ionizer-create-goal:
    require-or-fail the lead-rod;
    require-or-fail the fluorite;
    require-or-fail the ion-widget;
    require-or-fail the Machine-Test-Room;
    if goalstate is not hypothetical:
        retire the lead-rod by transformation into the ionizer;
        retire the fluorite by transformation into the ionizer;
        retire the ion-widget by transformation into the ionizer;
        now the player carries the ionizer;
        say "You tinker together an ionizer.";
    rule succeeds.
 
The iota-door-goal is an action-goal. The short-description is "open the iota-door".
Goal prereqs rule for iota-door-goal:
    require-or-fail the ionizer;
    if goalstate is not hypothetical:
        say "You ionize the iota-door open, melting down your ionizer.";
        now the ionizer is handled;
        retire the ionizer by applying to iota-door;
        now the iota-door is open;
    rule succeeds.
 
Zone step rule for iota-testzone:
    let targetzone be the zone-step-target of goalstate;
    [all directions are out]
    if iota-door is closed:
        require-or-fail the iota-door-goal;
    rule succeeds with result alpha-testzone.
 
The thagomizer is an ever-seen takeable-thing. The creation-action of the thagomizer is the thagomizer-create-goal.
 
The thagomizer-create-goal is a recallable action-goal.  The short-description is "create the thagomizer". The description is "You know how to build an thagomizer out of a pitrock and some lead wire."
 
Goal prereqs rule for thagomizer-create-goal:
    require-or-fail the pitrock;
    require-or-fail the lead-wire;
    if goalstate is not hypothetical:
        retire the pitrock by transformation into the thagomizer;
        retire the lead-wire by transformation into the thagomizer;
        now the player carries the thagomizer;
        say "You tinker together a thagomizer.";
    rule succeeds.
 
Chapter - Tutorial Falsework
 
A tutorial-node is a kind of object.
The tutorial-phase is a number that varies. The tutorial-phase is 99.
 
To tutor (T - tutorial-node) with (O - object):
    stop.
 
To tutor (T - tutorial-node):
    tutor T with nothing;
 
To say tutor (T - tutorial-node) with (O - object):
    tutor T with O;
 
To say tutor (T - tutorial-node):
    tutor T with nothing;
 
To close (T - tutorial-node):
    stop.
 
To invoke tutor-blank-command:
    stop.
 
Tut-initial is a tutorial-node.
Tut-invalid-verb is a tutorial-node.
Tut-vague-invoke is a tutorial-node.
Tut-examine-impet is a tutorial-node.
Tut-open-impet is a tutorial-node.
Tut-recalling-all is a tutorial-node.
Tut-recalling-formulae is a tutorial-node.
Tut-recalling-query is a tutorial-node.
Tut-formula-outside-ritual is a tutorial-node.
Tut-step-insert is a tutorial-node.
Tut-step-remove is a tutorial-node.
Tut-step-impet is a tutorial-node.
Tut-step-rosemary is a tutorial-node.
Tut-step-sealing is a tutorial-node.
Tut-step-unseal is a tutorial-node.
Tut-step-binding is a tutorial-node.
Tut-step-nature is a tutorial-node.
Tut-step-saturation is a tutorial-node.
Tut-step-success is a tutorial-node.
Tut-does-not-discharge is a tutorial-node.
Tut-saw-nature is a tutorial-node.
Tut-monocle-action is a tutorial-node.
 
 
Chapter - Debugging
 
Include HL Debug by Andrew Plotkin.
 
Section  - Debug Verbs - not for release
 
Show-zapping is an action applying to nothing.
Subst-zapping is an action applying to one thing and one substance-type.
Quickvis-zapping is an action out of world applying to one visible thing.
Nature-detect-zapping is an action out of world applying to one visible thing.
Fireproof-zapping is an action applying to nothing.
Chapter-zapping is an action out of world applying to nothing.
 
Env-setting it to is an action applying to one thing and one ritual-env.
Num-setting it to is an action applying to one thing and one number.
 
Understand "zap show", "zap-show" as show-zapping.
Understand "zap [something] to [substance-type]" as subst-zapping.
Understand "zap-qv [any thing]" as quickvis-zapping.
Understand "zap-fire", "zap-fireproof" as fireproof-zapping.
Understand "zap-chapter" as chapter-zapping.
Understand "qv-test [any thing]" as quickvis-zapping.
Understand "zap-nature [something]" as nature-detect-zapping.
Understand "nature-test [something]" as nature-detect-zapping.
Understand "ba-test" as a mistake ("Bare-array test:[br][barearray-unit-test][run paragraph on]").
Understand "quartz-avail" as a mistake ("Availability: [more available of long-quartz and broad-quartz].").
 
Include (-
! Declare some verbs to be meta at the dictionary level.
Dictionary 'zap-see' 2;
Dictionary 'zap-qv' 2;
Dictionary 'qv-test' 2;
Dictionary 'walk-test' 2;
Dictionary 'travel-test' 2;
Dictionary 'create-test' 2;
Dictionary 'make-test' 2;
Dictionary 'perform-test' 2;
-).
 
Carry out show-zapping:
    say "Global state:[line break]";
    if fire-consumption count is not zero:
        say "[fire-consumption count] objects are alight in the fire daemon.";
    if fire-potion-remaining is not zero:
        say "[fire-potion-remaining] turns of fire resistance potion remaining.";
    if breath-potion-remaining is not zero:
        say "[breath-potion-remaining] turns of breath potion remaining.";
    if breath-remaining is not zero:
        say "[breath-remaining] turns of breath remaining.";
    if vacuum-potion-remaining is not zero:
        say "[vacuum-potion-remaining] turns of vacuum potion remaining.";
    if aither-potion-remaining is not zero:
        say "[aither-potion-remaining] turns of aither potion remaining.";
 
Carry out quickvis-zapping:
    if the noun is quick-visible:
        say "[The noun] [is-are noun] quick-visible.";
    else:
        say "[The noun] [is-are noun] not quick-visible."
 
[
Carry out travel-test-zapping:
    say "Goal-travel to [the noun] ";
    if goal-travel possible to the noun:
        say "is possible, with [count of prereq-bare-array] prereqs: [the list of objects barelist-in prereq-bare-array].";
    else:
        say "is not possible."
 
Carry out create-test-zapping:
    say "Goal-creation of [the noun] ";
    if goal-creation possible for the noun:
        say "is possible, with [count of prereq-bare-array] prereqs: [the list of objects barelist-in prereq-bare-array].";
    else:
        say "is not possible."
 
Carry out perform-test-zapping:
    say "Goal-performance of [the noun] ";
    if goal-performance possible for the noun:
        say "is possible, with [count of prereq-bare-array] prereqs: [the list of objects barelist-in prereq-bare-array].";
    else:
        say "is not possible."
]
 
Carry out nature-detect-zapping:
    let V be the nature-evoke-string of the noun;
    if V is "":
        say "[The noun] has no essential nature.";
    else:
        say "You sense the [V]."
 
 
Carry out fireproof-zapping:
    if fire-potion-remaining is zero:
        now the fire-potion-remaining is 20;
        say "(DEBUG) You are fireproof.";
    else:
        now the fire-potion-remaining is zero;
        say "(DEBUG) You are not fireproof."
 
Carry out chapter-zapping:
        complete initial marriage.
 
Check zapping the env-dial:
    instead say "Available environments: [list of ritual-env]."
 
Check zapping the beaker:
    instead say "(DEBUG) Available substances: [list of substance-types]."
 
Check zapping the reservoir:
    instead say "(DEBUG) Available substances: [list of substance-types]."
 
Check zapping a ritual-bound:
    say "(DEBUG) [The noun] is [if rstate is active]active[else]not active[end if]."
 
Carry out zapping the safety-candle:
    zap-toggle-fire the noun.
 
Carry out zapping the brass-pin:
    if the noun is inscribed and the symbol-type of the noun is saturation-symbol:
        inscribe the noun with supersaturation-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun].";
    if the noun is inscribed and the symbol-type of the noun is supersaturation-symbol:
        inscribe the noun with gensaturation-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun].";
    else if the noun is inscribed:
        uninscribe the noun;
        instead say "Uninscribed [the noun].";
    else:
        inscribe the noun with saturation-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun]."
 
Carry out zapping the steel-bolt:
    if the noun is inscribed:
        uninscribe the noun;
        instead say "Uninscribed [the noun].";
    else:
        inscribe the noun with saturation-symbol;
        instead say "Inscribed [the noun]."
 
Carry out zapping a quartz-prism:
    if the noun is inscribed and the symbol-type of the noun is invisibility-symbol:
        inscribe the noun with imitation-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun].";
    else if the noun is inscribed and the symbol-type of the noun is imitation-symbol:
        inscribe the noun with impermeability-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun].";
    else if the noun is inscribed:
        uninscribe the noun;
        instead say "Uninscribed [the noun].";
    else:
        inscribe the noun with invisibility-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun]."
 
Carry out zapping a pebble:
    if the noun is inscribed and the symbol-type of the noun is gossamerity-symbol:
        inscribe the noun with ponderosity-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun].";
    else if the noun is inscribed:
        uninscribe the noun;
        instead say "Uninscribed [the noun].";
    else:
        inscribe the noun with gossamerity-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun]."
 
Carry out zapping a chime when the noun is the F-sharp-chime or the noun is the B-chime:
    if the noun is inscribed and the symbol-type of the noun is permeability-symbol:
        inscribe the noun with decoherence-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun].";
    else if the noun is inscribed and the symbol-type of the noun is decoherence-symbol:
        inscribe the noun with attraction-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun].";
    else if the noun is inscribed:
        uninscribe the noun;
        instead say "Uninscribed [the noun].";
    else:
        inscribe the noun with permeability-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun]."
 
Carry out zapping the silver-chain:
    instead zap-convert the silver-chain to the purity-lodestone.
 
Carry out zapping the silk-cord:
    now the el-earth is off-stage;
    instead zap-convert the silk-cord to the centrality-lodestone.
 
Carry out zapping the feather:
    instead zap-convert the feather to the dispersal-brush.
 
Carry out zapping the glass-loop:
    instead zap-convert the glass-loop to the oculus.
 
Carry out zapping a lens-or-lens:
    retire the convex-lens by transformation into the planetary-lens;
    retire the concave-lens by transformation into the planetary-lens;
    now the player carries the planetary-lens;
    set pronouns from the planetary-lens;
    say "(DEBUG) Turned the lenses into [the planetary-lens]."
 
Carry out zapping the rough-diamond:
    instead zap-convert the rough-diamond to the perfect-diamond.
 
Carry out zapping the electrum:
    now the electrum is ever-used;
    instead zap-convert the electrum to phlo-electrum.
 
Carry out zapping the scalpel:
    if the scalpel is dirty:
        now the scalpel is clean;
        instead say "(DEBUG) Cleansed the scalpel.";
    else:
        inscribe the noun with prophylaxis-symbol;
        instead say "Inscribed [the noun] with [symbol-type of noun]."
 
Carry out zapping a bubble:
    if the noun is uncharged:
        now the noun is charged;
        instead say "(DEBUG) Charged [the noun].";
    else:
        now the noun is uncharged;
        instead say "(DEBUG) Uncharged [the noun]."
 
Carry out zapping the crock:
    instead perform camphrost flashover.
 
Carry out subst-zapping the beaker:
    now the substance of the beaker is the substance-type understood;
    fix up the substance of the beaker;
    instead say "(DEBUG) The beaker is now full of [the substance of the beaker]."
 
Carry out subst-zapping the reservoir:
    now the substance of the reservoir is the substance-type understood;
    fix up the substance of the reservoir;
    instead say "(DEBUG) The reservoir is now full of [the substance of the reservoir]."
 
Carry out subst-zapping:
    instead say "You cannot zap [the noun] to [the substance-type understood]."
 
To zap-convert (T1 - thing) to (T2 - thing):
    [now T1 is off-stage;
    now the player carries T2;]
    substitute T2 for T1;
    set pronouns from T2;
    say "(DEBUG) Turned [the T1] into [the T2]."
 
Chapter - Sanity Checks and Debug Output
 
Include (-
Constant DEBUG_RITUAL 1;
! This is the "ritual.inform" test framework.
-) before "Parser.i6t";
 
To omni-zap everything else:
    do nothing.
 
To say barearray-unit-test:
    clear the generic-bare-array;
    say "Limit of generic is [limit of generic-bare-array].";
    say "Initial count is [count of generic-bare-array].";
    add the player to generic-bare-array;
    add the Kitchen to generic-bare-array;
    say "New count is [count of generic-bare-array].";
    say "... obj 0 is [object 0 of generic-bare-array], 1 is [object 1 of generic-bare-array].";
    say "... obj -1 is [object -1 of generic-bare-array], 2 is [object 2 of generic-bare-array].";
    add the env-dial to generic-bare-array;
    add the env-dial to generic-bare-array;
    add the env-dial to generic-bare-array;
    add the env-dial to generic-bare-array;
    add the env-dial to generic-bare-array;
    add the env-dial to generic-bare-array;
    add the env-dial to generic-bare-array;
    add the wand to generic-bare-array;
    say "Biggest count is [count of generic-bare-array].";
    say "... obj 9 is [object 9 of generic-bare-array].";
    say "Wand is [if wand is barelist-in generic-bare-array]in[else]not in[end if].";
    say "Kitchen is [if Kitchen is barelist-in generic-bare-array]in[else]not in[end if].";
    say "Beans is [if beans is barelist-in generic-bare-array]in[else]not in[end if].";
    add the beans to generic-bare-array;
    say "Post-biggest count is [count of generic-bare-array].";
    clear the generic-bare-array;
    say "Limit of generic is [limit of generic-bare-array].";
    say "Initial count is [count of generic-bare-array]."
 
After taking inventory:
    if a non-takeable thing is handled:
        say "(BUG) You have moved a non-takeable: [list of handled non-takeable things]."
 
To decide what bare-array is debug-rituals-bare-array: (- debugrituals_barearray -).
Include (-
Constant MAXIMUM_DEBUG_RITUAL_COUNT 8;
Array debugrituals_barearray table (MAXIMUM_DEBUG_RITUAL_COUNT +2);
-) before "Parser.i6t";
 
Every turn when the count of debug-rituals-bare-array is not zero:
    let curcount be count of debug-rituals-bare-array;
    repeat with ix running from 0 to curcount - 1:
        say "[em]{Goal done: [object ix of debug-rituals-bare-array].}[/em]";
    clear debug-rituals-bare-array.
 
Carry out omni-zapping:
    clear debug-rituals-bare-array.
 
Every turn when rstate is active:
    say "[em]([state of rstate]";
    if the primary-obj of rstate is not no-thing and the secondary-obj of rstate is not no-thing:
        say ", ([primary-obj of rstate] and [secondary-obj of rstate])";
    else if the primary-obj of rstate is not no-thing:
        say ", ([primary-obj of rstate])";
    else if the secondary-obj of rstate is not no-thing:
        say ", ([secondary-obj of rstate])";
    if the heating-time of the reservoir is not zero:
        say ", heating-time is [heating-time of reservoir]";
    if the mineral-used of rstate is not no-thing:
        say ", mineral-used is [mineral-used of rstate]";
    if the current-count of rstate is not zero:
        say ", current-count is [current-count of rstate]";
    say ", [env of rstate], bound is [bound of rstate], initiated by [initial-sealing of rstate]";
    let L be the shelf of rstate;
    if something is on L:
        say ", [L]: {[list of things on L]}";
    say ".)[/em]"