!7 module AskMeAQuestion > DynModule { S question, answer; visualize { if (empty(question)) newQuestion(); ret withRightMargin(makeForm2( "Computer question", dm_fieldLabel('question), "Human answer", centerAndEastWithMargin(onEnter(dm_fieldTextField('answer), rThread submit), jbutton("Submit", rThread submit)), "", withTopMargin(15, rightAlignedButtons("Ask me something else", rThread newQuestion)))); } S randomWord() { ret randomEnglishWordFromDictionary(); } void newQuestion enter { setFields(answer := "", question := "Is " + randomWord() + " the same as " + randomWord() + "?"); programLogStructure(litorderedmap(+question)); vmBus_send('showingQuestion, module(), question); } void submit enter { programLogStructure(litorderedmap(+question, +answer)); vmBus_send('userAnsweredQuestion, module(), question, answer); newQuestion(); } }