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).

!752

!include #1003380 // Chat
!include #1003370 // LooseBot

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

p {
  backend = run("#1003384");
  OccTree<E> tree = dialogs2occTree(printCount("Dialogs", loadDialogs("Color Showing Bot")));
  printOccTree(tree);
  dialogBot = new LooseBot(tree);
  dialogBot.debug = true;
  
  chat.onEnter_post = r {
    postIt(dialogBot.handle(ll(E.q(chat.input()))));
  };

  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 #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: 713 / 776
Referenced in: #1003406 - Color Showing Bot v2