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

26
LINES

< > BotCompany Repo | #1001212 // Conversation improvement bot

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

Libraryless. Click here for Pure Java version (428L/4K/11K).

// When talking to a bot, the need to remember its precise syntax
// is a little annoying. Let's change that.

!747

m {
  static S botID; // its program ID
  static L<S> questions;
  
  p {
    S program = loadSnippet(botID);
    questions = findQuestionsInSource(program);
  }
  
  static L<S> findQuestionsInSource(S src) {
    L<S> tok = javaTok(src);
    new L<S> questions;
    for (int i = 1; i+4 < tok.size(); i += 2) {
      if (tok.get(i).equals("match3") && tok.get(i+2).equals("(")
        && isQuoted(tok.get(i+4))) {
        questions.add(unquote(tok.get(i+4)));
      }
    }
    return questions;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001212
Snippet name: Conversation improvement bot
Eternal ID of this version: #1001212/1
Text MD5: c8d2657439677d76cfe9b039a794132c
Transpilation MD5: 820de225fc4fc3aa8f1bce8b70c4bf2a
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-02 15:10:03
Source code size: 643 bytes / 26 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 604 / 648
Referenced in: #3000190 - Answer for stefanreich(>> t 20 questions)
#3000202 - Answer for stefanreich (>> T conversion bot)
#3000238 - Answer for stefanreich (>> t power bot)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)