Creating a network of verbs

Say I want to make an AI system in which Alice sees Bob take action C, and performs action D in response. Yes, I can write a single “after Bob C-ing in the presence of Alice: add the action of Alice D-ing to the action queue of Alice” or similar, but that’s not ideal. I want the same action to have different responses in different conditions. Any ad-hoc system like that will quickly become impossible to maintain as the number of verbs and actors handled increases.

My question really is, how can I make a modular, easily extensible verb-response system? I’d like to have some simple ways to define connections between verbs, and conditions on actions, so that the system can be extended indefinitely. Most responses will require the reactor to be in the same location as the actor, for instance, but not all; and some would not be caused by any preceding verb, but rather by some other condition.

I get the feeling that I want to make a rulebook, or several rulebooks – one for linking one verb to its responses in all the different conditions, another for deciding how to populate that response with its noun, second noun, third noun, etc. as necessary. I’ve never made my own rulebook yet; am I on the right track?

Sounds like you want something likeEvery turn, consider the when reacting to rules. The when reacting to rules are a rulebook. And then write whatever.When reacting to someone examining the vase when in the presence of Xia, say "'Nice, isn't it? Very old, too.'" And so on.

If the reaction is to change at runtime and you don’t or can’t code the conditions beforehand in a rule, well, a table with a text column might be a partial answer. But you can’t construct action descriptions like someone that is angry with the actor during play. And you can’t stick a condition directly into a table column anyway, so in some senses you must hard code some things. Hence, back to the plain-jane rulebook.

Great, thanks Ron. Sorry I didn’t respond earlier.

Now I’ve gotten farther with this planned extension, but I’ve hit a snag with relations.

I have the following relation defined:

Association relates various lists of things to one number. The verb to be the associated value of implies the reversed association relation.

After writing “now 25 is the associated value of L”, how do I access that number later? Inform doesn’t allow you to call a name for the number in that definition, since the relation can’t be implemented as properties at the I6 level.

Yes, I could theoretically repeat with N running through every number from -99 to 99, testing if association relates L to N, but surely that’s not the most efficient method possible?

My first thought is the phrases the (name of kind) to which (value) relates by (relation) or the (name of kind) which (value) relates to by (relation) from chapter 13.13 in the manual. But I don’t know if they’ll work with lists, and IIRC when I tried testing a few of those phrases they had bugs.

No, your second was correct, unfortunately. Aside from the first two “if” statements, none of phrases on page 13.3 will function on relations between objects and values, only between values and values OR between objects and objects. So I could relate texts to numbers, and obtain the number variable so stored by stating Let N be the number which relates to T by the textual numeracy relation and the same with people to things; but I can’t relate a thing, or a room, or a list, to a particular number and have any hope of using that number later.

Argh. Can this object-to-values failure to compile really be intended behavior?

There seems to be a few bugs here, as you said: for instance, I notice that a relation of people to one vehicle doesn’t work, but various people to one thing does. I think I’ll get to Mantis.