!7 static LS questions = ll( "Do you have a car?", "Do you have a girlfriend?", "Do you own a boat?", "Are you tired?", ); concept Answer { S question, answer; } compact module AskYesNoQuestions > DynDialogWithUser { start { db(); if (empty(dialog)) newQuestion(); onUserInput(voidfunc(S input) { DialogItem q = nextToLast(dialog); if (q != null && eqic(q.author, 'Computer)) { S oldAnswer = getString(conceptWhere(Answer, question := q.line), 'answer); uniq_sync(Answer, question := q.line, answer := input); if (oldAnswer != null) if (match3_noWildcards(oldAnswer, input)) addLine('Computer, "Yes, I know."); else addLine('Computer, "I thought the answer was " + quote(oldAnswer) + "?"); else addLine('Computer, "Thanks, saved."); } }); } visualize { ret centerAndSouth(super.visualize(), withMargin(rightAlignedButtons("New Question", rThread newQuestion))); } void newQuestion { addLine('Computer, random(questions)); } // API L concepts() { ret list(Answer); } Concepts conceptsObject() { ret db_mainConcepts(); } }