mirror of
https://github.com/ganelson/inform.git
synced 2024-07-08 01:54:21 +03:00
38 lines
1.6 KiB
Plaintext
38 lines
1.6 KiB
Plaintext
* Lengthening or shortening a list
|
|
(Maze escaped by performing an exact sequence of actions; Leopard-skin)
|
|
A maze that the player can escape if he performs an exact sequence of actions.
|
|
|
|
Suppose (as in Infocom's Leather Goddesses of Phobos) that we have a maze that the player can escape only by performing the correct sequence of actions in the correct order. One way to do this would be to keep a list of the player's most recent actions, and see whether these match up with the combination we have established as the maze's solution.
|
|
|
|
For instance:
|
|
|
|
{*} "Leopard-skin"
|
|
|
|
The Fur-Lined Maze is a room. "This seemingly endless sequence of rooms is decorated in a tasteful selection of exotic furs and gilded fixtures."
|
|
|
|
Clapping is an action applying to nothing. Understand "clap" as clapping.
|
|
Kweepaing is an action applying to nothing. Understand "kweepa" as kweepaing.
|
|
|
|
Carry out clapping:
|
|
say "You clap."
|
|
|
|
Carry out kweepaing:
|
|
say "You holler 'KWEEPA!' triumphantly."
|
|
|
|
The maze-sequence is a list of stored actions that varies.
|
|
|
|
When play begins:
|
|
add jumping to the maze-sequence;
|
|
add clapping to the maze-sequence;
|
|
add kweepaing to the maze-sequence.
|
|
|
|
The attempted-sequence is a list of stored actions that varies.
|
|
|
|
Every turn when the player is in the Fur-Lined Maze:
|
|
truncate the attempted-sequence to the last two entries;
|
|
add the current action to the attempted-sequence;
|
|
if the attempted-sequence is the maze-sequence:
|
|
say "That does it! You are instantly transported from the maze!";
|
|
end the story finally.
|
|
|
|
Test me with "hop / clap / clap / hop / kweepa / hop / clap / kweepa". |