§16.15. Varying which table to look at

So far, we have always used fixed table names when referring to tables: for instance in source like "sort the Table of Recent Monarchs in accession order", we refer to the "Table of Recent Monarchs", a definite and explicitly named table.

With a little care, however, we are allowed to have variables which themselves hold the names of tables. This opens up the possibility of more elaborate ways of storing and interconnecting information in table form, but is probably best avoided until it becomes necessary.

For example, suppose we have two different tables with the same basic structure:

paste.png Table 1 - Nifty Opening Plays in US Scrabble

word

score

"muzjiks"

128

Table 2 - Nifty Opening Plays in UK Scrabble

word

score

"quartzy"

126

"squeezy"

126

We could then record which one of these tables to use in a variable:

The lexicon is a table name that varies. The lexicon is Table 1.

Note that for this purpose, the kind of value is a special kind called "table name", not "table". (The word "table" already has too many meanings and we must be careful to avoid ambiguities here.) We could make use of this as follows, for instance:

To flip tables:
    say "You exchange dictionaries, lexically crossing the Atlantic. ";
    if the lexicon is Table 1, now the lexicon is Table 2;
    otherwise now the lexicon is Table 1;
    choose a random row in the lexicon;
    say "Did you know that according to [the lexicon], [word entry] scores [score entry]?"

which produces text such as

You exchange dictionaries, lexically crossing the Atlantic. Did you know that according to Table 1 - Nifty Opening Plays in US Scrabble, muzjiks scores 128?


arrow-up.pngStart of Chapter 16: Tables
arrow-left.pngBack to §16.14. Another scoring example
arrow-right.pngOnward to §16.16. Defining things with tables

We begin with the idea that each person comes with his own table of things to say:

paste.png "Farewell"

A person has a table name called conversation.

Instead of asking someone about something:
    let the source be the conversation of the noun;
    if topic understood is a topic listed in source:
        if there is a turn stamp entry:
            say "[The noun] has already told you that [summary entry].";
        otherwise:
            now turn stamp entry is the turn count;
            say "[reply entry][paragraph break]";
    otherwise:
        say "[The noun] stares at you blankly."

For the sake of simplicity, we'll conflate asking and telling here, though it would certainly be possible to have a more complex implementation if we want the characters to be told things as well.

Instead of telling someone about something:
    try asking the noun about it.

Now we might want to add a recap command to review conversation that has already occurred.

Definition: a person is other if it is not the player.

Understand "recap" or "recall" or "review" as recalling conversations.

Recalling conversations is an action applying to nothing.

Since we've been recording the turn count of each conversation bit, we can even present these in order by sorting the tables first.

Carry out recalling conversations:
    repeat with speaker running through other people:
        let source be the conversation of the speaker;
        sort source in turn stamp order;
        say "[The speaker] has so far told you: [line break]";
        let index be 0;
        repeat through source:
            if there is a turn stamp entry:
                let index be 1;
                say " [summary entry][line break]";
        if index is 0, say " absolutely nothing[line break]";
        say conditional paragraph break.

Now it remains only to create a couple of characters and provide them both with something to say:

The Farewell Bend Cafe is a room. "Beautiful Farewell Bend, Idaho -- or is it Oregon? An almost-abandoned truckstop, in any case, on one of those interminable American east-west highways."

Tina is a woman in the Farewell Bend Cafe. The conversation of Tina is the Table of Tina's Chatter. "Tina the waitress is slowly pouring coffee from the pot with a black neck into the pot with an orange neck."

George is a man in the Farewell Bend Cafe. The conversation of George is the Table of George's Chatter. "There is also a large man at table five. The tattoo on his arm says George. For the moment we will assume that it is his own name and not someone else's."

Table of Tina's Chatter

topic

reply

summary

turn stamp

"aasvogel"

"'Oh, it's a vulture.'"

"that an aasvogel is a vulture"

a number

"acaudate"

"She shrugs, mid-pour. 'Means something doesn't have a tail.'"

"that acaudate means 'tailless'"

--

"absorptiometer"

"'It's a thing that measures the solubility of gases in a liquid,' she explains gently, as to a child."

"that an absorptiometer measures solubility of gasses in a liquid"

--

Table of George's Chatter

topic

reply

summary

turn stamp

"baccaceous"

"'Something that has or bears berries,' says George, without looking up."

"that baccaceous means berry-bearing or berry-like"

a number

"bagheera"

"'Oh, that'd be a velvet-like textile.'"

"that bagheera is a velvet-like textile"

--

"balistarius"

"'That's a crossbow-man,' George replies instantly."

"that a balistarius is a crossbow-man"

--

A word of warning: this system does assume that every person in the game has a conversation table defined. If that were not the case, we would have to be a bit more careful.

As always, we can override specific words, too:

Instead of asking Tina about "advertisement" for the first time:
    say "Tina looks embarrassed. 'Of course! I almost forgot.' She hands you a brochure.";
    move the brochure to the player.

The encyclopedia sales brochure is a thing. The description is "A glossy flyer indicating that you can receive a free Volume A-Aalto of the New Idahoan Encyclopedia Set if you send back the business reply card, and then have the option of purchasing the remaining volumes at a very very reasonable price."

Test me with "recap / ask tina about aasvogel / recap / ask george about baccaceous / ask tina about absorptiometer / recap / ask tina about advertisement / read brochure".

**ExampleFarewell
People who respond to conversational gambits, summarize what they said before if asked again, and provide recap of conversation that is past.

We begin with the idea that each person comes with his own table of things to say:

paste.png "Farewell"

A person has a table name called conversation.

Instead of asking someone about something:
    let the source be the conversation of the noun;
    if topic understood is a topic listed in source:
        if there is a turn stamp entry:
            say "[The noun] has already told you that [summary entry].";
        otherwise:
            now turn stamp entry is the turn count;
            say "[reply entry][paragraph break]";
    otherwise:
        say "[The noun] stares at you blankly."

For the sake of simplicity, we'll conflate asking and telling here, though it would certainly be possible to have a more complex implementation if we want the characters to be told things as well.

Instead of telling someone about something:
    try asking the noun about it.

Now we might want to add a recap command to review conversation that has already occurred.

Definition: a person is other if it is not the player.

Understand "recap" or "recall" or "review" as recalling conversations.

Recalling conversations is an action applying to nothing.

Since we've been recording the turn count of each conversation bit, we can even present these in order by sorting the tables first.

Carry out recalling conversations:
    repeat with speaker running through other people:
        let source be the conversation of the speaker;
        sort source in turn stamp order;
        say "[The speaker] has so far told you: [line break]";
        let index be 0;
        repeat through source:
            if there is a turn stamp entry:
                let index be 1;
                say " [summary entry][line break]";
        if index is 0, say " absolutely nothing[line break]";
        say conditional paragraph break.

Now it remains only to create a couple of characters and provide them both with something to say:

The Farewell Bend Cafe is a room. "Beautiful Farewell Bend, Idaho -- or is it Oregon? An almost-abandoned truckstop, in any case, on one of those interminable American east-west highways."

Tina is a woman in the Farewell Bend Cafe. The conversation of Tina is the Table of Tina's Chatter. "Tina the waitress is slowly pouring coffee from the pot with a black neck into the pot with an orange neck."

George is a man in the Farewell Bend Cafe. The conversation of George is the Table of George's Chatter. "There is also a large man at table five. The tattoo on his arm says George. For the moment we will assume that it is his own name and not someone else's."

Table of Tina's Chatter

topic

reply

summary

turn stamp

"aasvogel"

"'Oh, it's a vulture.'"

"that an aasvogel is a vulture"

a number

"acaudate"

"She shrugs, mid-pour. 'Means something doesn't have a tail.'"

"that acaudate means 'tailless'"

--

"absorptiometer"

"'It's a thing that measures the solubility of gases in a liquid,' she explains gently, as to a child."

"that an absorptiometer measures solubility of gasses in a liquid"

--

Table of George's Chatter

topic

reply

summary

turn stamp

"baccaceous"

"'Something that has or bears berries,' says George, without looking up."

"that baccaceous means berry-bearing or berry-like"

a number

"bagheera"

"'Oh, that'd be a velvet-like textile.'"

"that bagheera is a velvet-like textile"

--

"balistarius"

"'That's a crossbow-man,' George replies instantly."

"that a balistarius is a crossbow-man"

--

A word of warning: this system does assume that every person in the game has a conversation table defined. If that were not the case, we would have to be a bit more careful.

As always, we can override specific words, too:

Instead of asking Tina about "advertisement" for the first time:
    say "Tina looks embarrassed. 'Of course! I almost forgot.' She hands you a brochure.";
    move the brochure to the player.

The encyclopedia sales brochure is a thing. The description is "A glossy flyer indicating that you can receive a free Volume A-Aalto of the New Idahoan Encyclopedia Set if you send back the business reply card, and then have the option of purchasing the remaining volumes at a very very reasonable price."

Test me with "recap / ask tina about aasvogel / recap / ask george about baccaceous / ask tina about absorptiometer / recap / ask tina about advertisement / read brochure".

We begin with the idea that each person comes with his own table of things to say:

paste.png "Farewell"

A person has a table name called conversation.

Instead of asking someone about something:
    let the source be the conversation of the noun;
    if topic understood is a topic listed in source:
        if there is a turn stamp entry:
            say "[The noun] has already told you that [summary entry].";
        otherwise:
            now turn stamp entry is the turn count;
            say "[reply entry][paragraph break]";
    otherwise:
        say "[The noun] stares at you blankly."

For the sake of simplicity, we'll conflate asking and telling here, though it would certainly be possible to have a more complex implementation if we want the characters to be told things as well.

Instead of telling someone about something:
    try asking the noun about it.

Now we might want to add a recap command to review conversation that has already occurred.

Definition: a person is other if it is not the player.

Understand "recap" or "recall" or "review" as recalling conversations.

Recalling conversations is an action applying to nothing.

Since we've been recording the turn count of each conversation bit, we can even present these in order by sorting the tables first.

Carry out recalling conversations:
    repeat with speaker running through other people:
        let source be the conversation of the speaker;
        sort source in turn stamp order;
        say "[The speaker] has so far told you: [line break]";
        let index be 0;
        repeat through source:
            if there is a turn stamp entry:
                let index be 1;
                say " [summary entry][line break]";
        if index is 0, say " absolutely nothing[line break]";
        say conditional paragraph break.

Now it remains only to create a couple of characters and provide them both with something to say:

The Farewell Bend Cafe is a room. "Beautiful Farewell Bend, Idaho -- or is it Oregon? An almost-abandoned truckstop, in any case, on one of those interminable American east-west highways."

Tina is a woman in the Farewell Bend Cafe. The conversation of Tina is the Table of Tina's Chatter. "Tina the waitress is slowly pouring coffee from the pot with a black neck into the pot with an orange neck."

George is a man in the Farewell Bend Cafe. The conversation of George is the Table of George's Chatter. "There is also a large man at table five. The tattoo on his arm says George. For the moment we will assume that it is his own name and not someone else's."

Table of Tina's Chatter

topic

reply

summary

turn stamp

"aasvogel"

"'Oh, it's a vulture.'"

"that an aasvogel is a vulture"

a number

"acaudate"

"She shrugs, mid-pour. 'Means something doesn't have a tail.'"

"that acaudate means 'tailless'"

--

"absorptiometer"

"'It's a thing that measures the solubility of gases in a liquid,' she explains gently, as to a child."

"that an absorptiometer measures solubility of gasses in a liquid"

--

Table of George's Chatter

topic

reply

summary

turn stamp

"baccaceous"

"'Something that has or bears berries,' says George, without looking up."

"that baccaceous means berry-bearing or berry-like"

a number

"bagheera"

"'Oh, that'd be a velvet-like textile.'"

"that bagheera is a velvet-like textile"

--

"balistarius"

"'That's a crossbow-man,' George replies instantly."

"that a balistarius is a crossbow-man"

--

A word of warning: this system does assume that every person in the game has a conversation table defined. If that were not the case, we would have to be a bit more careful.

As always, we can override specific words, too:

Instead of asking Tina about "advertisement" for the first time:
    say "Tina looks embarrassed. 'Of course! I almost forgot.' She hands you a brochure.";
    move the brochure to the player.

The encyclopedia sales brochure is a thing. The description is "A glossy flyer indicating that you can receive a free Volume A-Aalto of the New Idahoan Encyclopedia Set if you send back the business reply card, and then have the option of purchasing the remaining volumes at a very very reasonable price."

Test me with "recap / ask tina about aasvogel / recap / ask george about baccaceous / ask tina about absorptiometer / recap / ask tina about advertisement / read brochure".