Libraryless. Click here for Pure Java version (3036L/21K/70K).
1 | !759 |
2 | |
3 | !include #1003380 // Chat |
4 | !include #1003413 // LooseBot v5 |
5 | |
6 | static new Chat chat; |
7 | static LooseBot dialogBot; |
8 | static O backend; |
9 | |
10 | p { |
11 | backend = run("#1003384"); |
12 | OccTree2 tree = goodDialogs2occTree2(printCount("Dialogs", loadDialogs("Color Showing Bot"))); |
13 | printOccTree2(tree); |
14 | dialogBot = new LooseBot(tree, func { new WordAdapter }); |
15 | callOpt(dialogBot, "noRewind"); |
16 | dialogBot.debug = true; |
17 | |
18 | chat.onEnter_post = r { |
19 | dialogBot.take(E.q(chat.input())); |
20 | new L<E> l; |
21 | E e; |
22 | while ((e = dialogBot.getSingleOutput()) != null) |
23 | l.add(e); |
24 | postIt(l); |
25 | }; |
26 | |
27 | showFrame("Chat with " + programTitle(), chat); |
28 | chat.requestFocus(); |
29 | } |
30 | |
31 | svoid postIt(final L<E> l) { |
32 | for (int i = 0; i < l(l); i++) { |
33 | E e = l.get(i); |
34 | if (e.a()) |
35 | chat.append("Bot: " + e.a + "\n"); |
36 | else if (e.state()) { |
37 | chat.append("[" + e.state + "]\n"); |
38 | final int _i = i; |
39 | Runnable l8r = r { postIt(subList(l, _i)); }; |
40 | if ((bool) call(backend, "action", e.state, l8r)) |
41 | break; |
42 | } |
43 | } |
44 | } |
Began life as a copy of #1003389
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: | #1003406 |
Snippet name: | Color Showing Bot v2 |
Eternal ID of this version: | #1003406/1 |
Text MD5: | 8b2daaa1fa880e4cd2e1d7c57693ffd8 |
Transpilation MD5: | f6cf972635d809ee5556775caae81d20 |
Author: | stefan |
Category: | javax / talking robots |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-07-01 21:37:39 |
Source code size: | 1076 bytes / 44 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 661 / 922 |
Referenced in: | [show references] |