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

44
LINES

< > BotCompany Repo | #1003406 // Color Showing Bot v2

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

Libraryless. Click here for Pure Java version (3036L/21K/70K).

!759

!include #1003380 // Chat
!include #1003413 // LooseBot v5

static new Chat chat;
static LooseBot dialogBot;
static O backend;

p {
  backend = run("#1003384");
  OccTree2 tree = goodDialogs2occTree2(printCount("Dialogs", loadDialogs("Color Showing Bot")));
  printOccTree2(tree);
  dialogBot = new LooseBot(tree, func { new WordAdapter });
  callOpt(dialogBot, "noRewind");
  dialogBot.debug = true;
  
  chat.onEnter_post = r {
    dialogBot.take(E.q(chat.input()));
    new L<E> l;
    E e;
    while ((e = dialogBot.getSingleOutput()) != null)
      l.add(e);
    postIt(l);
  };

  showFrame("Chat with " + programTitle(), chat);
  chat.requestFocus();
}

svoid postIt(final L<E> l) {
  for (int i = 0; i < l(l); i++) {
    E e = l.get(i);
    if (e.a())
      chat.append("Bot: " + e.a + "\n");
    else if (e.state()) {
      chat.append("[" + e.state + "]\n");
      final int _i = i;
      Runnable l8r = r { postIt(subList(l, _i)); };
      if ((bool) call(backend, "action", e.state, l8r))
        break;
    }
  }
}

Author comment

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: 597 / 836
Referenced in: [show references]