Aristotle's Topics — 15 of 18

Hugh Burns

Release 1

Section 7 - The Main Loop

The saved input flag is a truth state that varies. The saved input flag is false.

To run the main loop:

if the saved input flag is true:

now the saved input flag is false;

otherwise:

while 0 < 1:

print "[line break][line break]";

get a line of input, ignoring blank lines;

if the user input matches the text "CONTINUE!":

segue into the next question, maybe offering a subject change;

else if the user input is "NO":

respond to NO after a prompt;

else:

break;

if the user input matches the text "STOP!":

quit;

else if the user input matches the text "REPEAT!":

repeat the question;

else if the user input is "?":

let the user ask a question;

else if the user input matches the text "DIRECTIONS!":

show directions and commands;

get back to the questions;

else if the user input matches the regular expression "HOW.*\?":

answer a HOW question;

else if the user input matches the regular expression "WHY.*\?":

answer a WHY question;

else if the user input matches the text "&&":

encourage the user to go on;

else if the user input matches the text "EXPLAIN!":

explain the question;

else if the user input matches the regular expression " DO.*N.*T .*UNDERST":

explain the question;

else if the user input matches the regular expression " DO.*N.*T .*KNOW":

explain the question;

else if the user input matches the text "CHANGE!":

change the subject;

segue into the next question [without offering a subject change, since we just did that];

else if the user input matches the regular expression "WHAT.*\?":

explain the question;

else if the user input matches the regular expression "MEAN.*\?":

explain the question;

else if the user input matches the regular expression " OR .*\?":

answer an OR question;

else if the user input matches the regular expression "CAN I .*\?":

answer affirmatively;

else if the user input matches the regular expression "IS .*IT .*\?":

answer affirmatively;

else if the user input matches the text "BECAUSE":

reward BECAUSE;

perform exploration branching and feedback, without initial line breaks;

else if the user input matches the text "?":

respond to an unrecognized question;

else if the something else flag is true:

[06160]

print "[line break][tab]OKAY.[line break]";

segue into the next question, maybe offering a subject change;

else if the ampersand usage flag is true:

perform exploration branching and feedback;

else if the number of characters in the user input is less than 10:

encourage elaboration;

else if the user input is grandiloquent:

respond to garbage or jargon;

else:

perform exploration branching and feedback.

To get back to the questions [after printing directions]: [01510]

print "[tab]BACK TO THE QUESTIONS, [first name] --> --> -->[line break][line break][line break][line break][tab][tab]BUT FIRST, IS THERE[line break]";

ask anything else.

To perform exploration branching and feedback, without initial line breaks:

[05770 <<< EXPLORATION BRANCHING AND FEEDBACK >>>]

if not without initial line breaks:

print "[line break][line break]";

increment the exploration meter;

if the exploration meter is 1:

print "[one of]GOOD, [first name], ADD TO YOUR RESPONSE NOW.[or]FINE, [first name]. WRITE SOME MORE.[or]THAT'S THE IDEA, [first name]. GIVE ME SOME MORE INFO NOW.[or]BY GEORGE, [first name], GOOD ONE. WRITE A LITTLE MORE PLEASE.[purely at random][line break]";

otherwise:

print "[one of]SUPER[or]OUTSTANDING[or]FANTASTIC[or]TERRIFIC[or]GREAT[purely at random], [first name]![line break][line break]";

increment the explore count;

ask anything else.

To ask anything else: [06050]

print "[tab][tab]ANYTHING ELSE?[line break]";

if the explore count <= 2:

print "[tab][tab](YOU CAN ADD MORE INFO, ASK A[line break][tab][tab]QUESTION, OR GIVE A COMMAND --[line break][tab][tab]WHATEVER YOU WISH.)[line break][line break]";

if the user agrees: [<--- note that this sets "the user input", which is used in the "otherwise:" case]

[06780 'ANSWERS A *YE* TO ANYTHING ELSE?]

print "[line break]WHAT?[line break]";

otherwise:

now the something else flag is true;

now the saved input flag is true.

To respond to NO after a prompt:

[06622 'RESPONDS TO I$=NO AFTER INVENTION PROMPTER]

print "[line break][tab]YOU COULD TELL ME 'WHY NOT', BUT YOU[line break]MAY JUST WANT TO CONTINUE. IF SO, TYPE 'CONTINUE![line break](DON'T FORGET THE EXCLAMATION POINT!)[line break]".

To decide if (line - some text) is grandiloquent:

[05650 'CHECKS LENGTH OF INDIVIDUAL WORDS IN STRING]

repeat with K running from 1 to the number of unpunctuated words in the line:

let W be unpunctuated word number K in the line;

if the number of characters in W is greater than 15:

decide yes;

decide no.

To respond to garbage or jargon:

[06630 'RESPONSE TO 'GARBAGE' OR JARGON]

print "[line break][tab]HEY, [first name], WHAT KIND OF LANGUAGE IS THAT?[line break][tab]TRY AGAIN. I JUST CAN'T UNDERSTAND WHAT YOU SAID?[line break][line break][tab](YOU MAY HAVE RUN SOME OF YOUR WORDS TOGETHER,[line break][tab]SO IF YOU CAN UNDERSTAND WHAT YOU MEAN, JUST[line break][tab]KEEP ON ANSWERING THE QUESTION. I'LL REPEAT[line break][tab]THE QUESTION IF YOU TYPE 'REPEAT!')[line break]".

To encourage the user to go on:

print "[line break]GO ON, [first name].[line break]";

now the ampersand usage flag is true.

To let the user ask a question:

[06750 'ANSWERS THE SINGLE QUESTION MARK (I$="?")]

print "[line break]GO AHEAD, [first name], ASK. I'LL DO THE BEST I CAN.[line break]".

To answer a HOW question:

[06810 'ANSWERS THE QUESTION *HOW*?*]

print "[line break]I COULD SAY THAT THAT'S FOR ME TO KNOW AND FOR YOU TO FIND OUT.[line break][line break]SERIOUSLY, I CANNOT PRETEND TO KNOW 'HOW', BUT YOU[line break]SHOULD KEEP EXPLORING FOR AN ANSWER.[line break][line break]".

To answer a WHY question:

[06880 'ANSWERS THE QUESTION *WHY*?*]

print "[line break]WELL, WHY NOT? REMEMBER WE ARE EXPLORING, BRAINSTORMING![line break][line break]".

To change the subject:

[06920 'ANSWERS THE *CHANGE!* COMMAND]

print "[first time][line break]GOOD FOR YOU, [first name]. NOT EVERY WRITER NARROWS OR[line break]CHANGES HIS OR HER TOPIC THIS EARLY IN THE INVENTION PROCESS.[line break][only]";

print "[line break]PLEASE TYPE IN YOUR NEW SUBJECT:[line break]";

input the subject;

print "[line break]YOUR REVISED SUBJECT IS [the subject].[line break][line break][line break][line break][line break][line break]".

To answer an OR question:

[07000 'ANSWERS QUESTION * OR *?*]

print "[line break]WHATEVER YOU THINK BEST, [first name]. YOU DECIDE.[line break][line break]";

To answer affirmatively:

[07040 'ANSWERS QUESTION *CAN I *?*]

print "[line break]YES, OF COURSE.[line break][line break]".

To reward BECAUSE:

[07080 'RESPONDS TO SUBORDINATE *BECAUSE*]

print "[line break][tab]I LIKE YOUR REASONING.[line break]".

To respond to an unrecognized question:

[07110 'RESPONDS TO *?*]

print "[line break]";

increment the unrecognized question count;

if the unrecognized question count is less than 2:

[07180]

print "YES, THAT SEEMS OKAY.[line break]";

print "[line break][tab][prompt C][line break]";

else if the unrecognized question count is greater than 2:

[07210]

print "THIS QUESTION MAY BE BETTER ANSWERED[line break]DURING THE RESEARCH PHASE. KEEP IT IN MIND.[line break]";

print "[line break][tab][prompt B][line break]";

else:

[07150]

print "ANOTHER INTERESTING QUESTION. I'D SAY 'YES'.[line break]";

print "[line break][tab][prompt A][line break]".

To encourage elaboration:

[07240 'RESPONDS TO SHORT ANSWERS]

print "[line break][tab]AHHH, SHORT AND SWEET. NOW TELL ME[line break][tab]WHY? IN OTHER WORDS, ELABORATE A LITTLE.[line break][line break]".

To offer a change of subject:

[07290 'AUTO NARROW/CHANGE LOOP]

print "[line break][line break]DO YOU WISH TO NARROW OR CHANGE YOUR SUBJECT?[line break](MAYBE REVISE THE WAY IT SOUNDS IN THESE QUESTIONS?)[line break][tab](YES OR NO?)[line break]";

if the user agrees:

change the subject;

otherwise:

print "[line break][line break][line break][line break]".