Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

38
LINES

< > BotCompany Repo | #1003389 // Color Showing Bot (works, just not for repetitions)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (3058L/22K/72K).

1  
!752
2  
3  
!include #1003380 // Chat
4  
!include #1003370 // LooseBot
5  
6  
static new Chat chat;
7  
static LooseBot dialogBot;
8  
static O backend;
9  
10  
p {
11  
  backend = run("#1003384");
12  
  OccTree<E> tree = dialogs2occTree(printCount("Dialogs", loadDialogs("Color Showing Bot")));
13  
  printOccTree(tree);
14  
  dialogBot = new LooseBot(tree);
15  
  dialogBot.debug = true;
16  
  
17  
  chat.onEnter_post = r {
18  
    postIt(dialogBot.handle(ll(E.q(chat.input()))));
19  
  };
20  
21  
  showFrame("Chat with " + programTitle(), chat);
22  
  chat.requestFocus();
23  
}
24  
25  
svoid postIt(final L<E> l) {
26  
  for (int i = 0; i < l(l); i++) {
27  
    E e = l.get(i);
28  
    if (e.a())
29  
      chat.append("Bot: " + e.a + "\n");
30  
    else if (e.state()) {
31  
      chat.append("[" + e.state + "]\n");
32  
      final int _i = i;
33  
      Runnable l8r = r { postIt(subList(l, _i)); };
34  
      if ((bool) call(backend, "action", e.state, l8r))
35  
        break;
36  
    }
37  
  }
38  
}

Author comment

Began life as a copy of #1003350

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: #1003389
Snippet name: Color Showing Bot (works, just not for repetitions)
Eternal ID of this version: #1003389/1
Text MD5: 1b37bce913ff08d7bdc17cb07100dd9d
Transpilation MD5: e04e6cfadd9c04fc0bcf95f9be315fe6
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-29 02:40:20
Source code size: 907 bytes / 38 lines
Pitched / IR pitched: No / No
Views / Downloads: 712 / 776
Referenced in: [show references]