Tinkertoy Text

The Encounter System will present its output in plain text. It must be able to handle variability in the identities of the Protagonist and the Antagonist.

The current implementation of the Tinkertoy Text system is quite simple, and is most easily expressed in the Java method in which it is implemented:

public String decodeText(int tAntagonist, int tProtagonist, String inputString) {

String output = inputString.replaceAll("=antagonistName=",actor[tAntagonist].getLabel());

output = output.replaceAll("=AntagonistName=",actor[tAntagonist].getLabel());

output = output.replaceAll("=ProtagonistName=", actor[tProtagonist].getLabel());

output = output.replaceAll("=protagonistName=", actor[tProtagonist].getLabel());

output = output.replaceAll("=he/she=", actor[tAntagonist].getIsMale() ? "he":"she");

output = output.replaceAll("=He/She=", actor[tAntagonist].getIsMale() ? "He":"She");

output = output.replaceAll("=Him/Her=",actor[tAntagonist].getIsMale() ? "Him":"Her");

output = output.replaceAll("=him/her=",actor[tAntagonist].getIsMale() ? "him":"her");

output = output.replaceAll("=his/her=", actor[tAntagonist].getIsMale() ? "his":"her");

output = output.replaceAll("=His/Her=", actor[tAntagonist].getIsMale() ? "His":"Her");

output = output.replaceAll("=his/hers=",actor[tAntagonist].getIsMale() ? "his":"hers");

output = output.replaceAll("=His/Hers=",actor[tAntagonist].getIsMale() ? "His":"Hers");

return output;

}

This system is primitive in the extreme. A few additions:

A system for choosing alternate phrasings using a Bounded Number:

BNumber {phrase1 | phrase2 | phrase 3 | phrase 4…}

This would count the number of phrases and then use the BNumber to select one corresponding to the value of the BNumber. The BNumber could be a random value or it could be a quantifier. I used a system like this as far back as the original Balance of Power in 1984.

The computer science community has made great strides in text generation. I am not familiar with any of this work, but I suspect that somebody knowledgeable in the field could suggest much better approaches.