Libraryless. Click here for Pure Java version (3884L/27K/97K).
!759 static JTable questionsTable; p-substance { showFrame( hgrid( withTitle("Logic List", centerAndSouth( logicListTable(), vgrid( jbutton("Add care...", r { addCareDialog() }), jbutton("Add statement...", r { addStatementDialog() })))), withTitle("Questions", questionsTable = tableWithToolTips()))); onDoubleClickOrEnter(questionsTable, voidfunc(int row) { answerQuestion(row); }); tablePopupMenu(questionsTable, voidfunc(JPopupMenu menu, final int row) { menu.add(jmenuitem("Answer question...", r { answerQuestion(row) })); }); // TODO: thinker thread swingEvery(questionsTable, 1000, 50, r { if (tableShouldThink(questionsTable)) dataToTable_uneditable(questionsTable, makeQuestions()); }); } static L<S> makeQuestions() { long time = now(); genLog_set(map(func(S s) { lastLine(s) }, gLogicList())); new L<S> l; for (S care : gCares()) { if (gMatchStart(format("* is", care)) == null && gMatchStart(format("a * is", care)) == null && gMatchStart(format("the * is", care)) == null) l.add(format("What is *?", toUpper(care))); } done(time, "Making Questions"); ret l; } static S presetAnswer(S s) { new Matches m; if "what is *" ret format("* is ...", m.unq(0)); null; } static void answerQuestion(int row) { SS line = getTableLineAsMap(questionsTable, row); final S q = firstValue(line); if (empty(q)) ret; final JTextField textField = new JTextField(unnull(presetAnswer(q))); showForm( "Question", q, "Answer", textField, r { addToLogicList(fromLines(q, textField.getText())); }); }
Began life as a copy of #1004394
download show line numbers debug dex old transpilations
Travelled to 31 computer(s): aoiabmzegqzx, ayokdxtdmvtg, bhatertpkbcr, bwoimkvrfqyu, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, etmzoiygucik, gwrvuhgaqvyk, iavmkmvmshxs, ishqpsrjomds, jmyaexzvplwz, jttmaavzamyx, lhdilzshxjzv, lpdgvwnxivlt, mqqgnosmbjvj, nbgitpuheiab, nzrhlmtlsyqh, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, sekmkcqzslie, tpsnldywmnmr, tslmcundralx, tvejysmllsmz, unoaxrwscvea, vouqrxazstgt, vpdwwinrgdga, wnvtyfxbogru, xfasiavlzxuf, xpvikbxxwzsu
No comments. add comment
Snippet ID: | #1004419 |
Snippet name: | A.I.'s Questions |
Eternal ID of this version: | #1004419/1 |
Text MD5: | 5a62633cdf72fe9134602c53ae342fc0 |
Transpilation MD5: | 84699dccd04d6bce2c7e2f2b98341dcf |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-28 17:35:10 |
Source code size: | 1743 bytes / 62 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 719 / 1537 |
Referenced in: | #1004308 - Random Main v10 |