Libraryless. Click here for Pure Java version (2509L/18K/60K).
1 | !752 |
2 | |
3 | snew JTextArea thoughtArea; |
4 | snew JTextArea chatArea; |
5 | snew JTextField chatField; |
6 | |
7 | static OccTree<E> tree, current; |
8 | static new L<E> chat; |
9 | |
10 | p { |
11 | tree = current = dialogs2occTree(loadDialogs("Let's do GMail")); |
12 | |
13 | showSideBySide( |
14 | withTitle("Chat", centerAndSouth(chatArea, chatField)), |
15 | withTitle("Thoughts", thoughtArea)); |
16 | |
17 | chatField.requestFocus(); |
18 | onEnter(chatField, runnable { |
19 | pcall { |
20 | } |
21 | chat.add(E.q(userInput())); |
22 | renderChat(); |
23 | chatField.selectAll(); |
24 | }); |
25 | |
26 | swingEverySecond(thoughtArea, runnable { predict(); }); |
27 | } |
28 | |
29 | svoid predict { |
30 | new StringBuilder buf; |
31 | try { |
32 | } catch e { |
33 | buf.append("\n\n" + getStackTrace(e)); |
34 | } |
35 | setText(thoughtArea, buf); |
36 | } |
37 | |
38 | sS nextMove { |
39 | S input = userInput(); |
40 | ret "stop"; |
41 | } |
42 | |
43 | sS userInput { |
44 | ret chatField.getText().trim(); |
45 | } |
46 | |
47 | svoid renderChat { |
48 | chatArea.setText(unparsePoem(chat)); |
49 | } |
Began life as a copy of #1003306
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003350 |
Snippet name: | Tree-Based GMail Bot (non-functional) |
Eternal ID of this version: | #1003350/1 |
Text MD5: | 89e5a5cf5d729366344c2a729343b54a |
Transpilation MD5: | abf27b64b1e468ee73726000fb7dd85e |
Author: | stefan |
Category: | javax / talking robots |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-06-28 22:57:10 |
Source code size: | 921 bytes / 49 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 539 / 576 |
Referenced in: | [show references] |