| Chapter 15: Tables |

| 15.10. Adding and removing rows

Writing in new rows is simple:

> choose a blank row in Table 3;
> change element entry to "Fluorine";
> change symbol to "F";
> change atomic number to 9;
> change atomic weight to 19;

This will produce an error if there are no blank rows left in Table 3, so it can be important to worry about free space. To that end we can not only find the number of rows (as we have already seen) but also the number currently blank and not blank. Thus these:

> the number of blank rows in Table 3
> the number of filled rows in Table 3

always add up to "the number of rows in Table 3".

To delete a row, we first choose it and then "blank out the whole row". Thus, for abdication purposes:

> choose row with name of "Edward VIII" in the Table of Recent Monarchs;
> blank out the whole row;

210
| Example Odyssey A person who follows a path predetermined and stored in a table, and who can be delayed if the player tries to interact with her.

"Odyssey" Corinth is a room. Athens is east of Corinth. Epidaurus is southeast of Corinth and east of Mycenae. Mycenae is south of Corinth. Olympia is west of Mycenae. Argos is south of Mycenae. Thebes is northwest of Athens. Pylos is south of Olympia. Sparta is east of Pylos and south of Argos. Delphi is northwest of Thebes. Athena is a woman in Athens. Athena will proceed, unless delayed, through a list of locations stored in a simple table. Rather than using Inform's route-finding abilities ("the best route from..."), we simply move Athena from one location to the next, not even using the going action: she moves in mysterious ways, as befits a goddess. Table of Athena's Movement destination Thebes Delphi Thebes Athens Corinth Mycenae Every turn when Athena is active: repeat through the Table of Athena's Movement begin; let last space be the location of Athena; if Athena can be seen by the player, say "Athena heads to [the destination entry]."; move Athena to destination entry; if Athena can be seen by the player, say "Athena arrives from [the last space]."; blank out the whole row; rule succeeds; end repeat. By blanking out the table line by line, we make sure that we never lose our place in the path. Since we want the player to be able to talk to Athena, we need a way to stall her in her path, as well. Athena can be active or passive. Athena is active. Before doing something to Athena: change Athena to passive; say "Athena waits around patiently, though you can tell she would like to leave..." Instead of telling Athena about something: say "She watches you patiently as though to say that she already knows." Instead of asking Athena about something: say "Her response is inscrutably ancient and Greek. Afterwards you remember only the flash of bright eyes." Finally, we do need to wake Athena up again if she has become passive. The following rule will occur after the movement rule just because of code ordering, though we could make matters more explicit if we needed to: Every turn when Athena is passive: change Athena to active. Test me with "east / northwest / wait / examine athena / wait".

Previous | Contents | Next