Warning: session_start(): open(/var/lib/php/sessions/sess_ealt23e91pb2pitage7lhuksgt, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
static LS questions = ll(
"What's your name?",
"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 AskQuestions > DynDialogWithUser {
class CRUD {
replace A with Answer.
CRUD() { conceptClass = A; }
!include #1026525 // DynCRUD Include
}
new CRUD crud;
start {
crud.start_DynCRUD();
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.");
}
});
}
visual jtabs("Dialog" :=
centerAndSouth(super,
withMargin(rightAlignedButtons("New Question", rThread newQuestion))), "CRUD" := crud.visualize());
void newQuestion {
addLine('Computer, random(questions));
}
// API
L concepts() { ret list(Answer); }
Concepts conceptsObject() { ret db_mainConcepts(); }
}