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

34
LINES

< > BotCompany Repo | #1002480 // Simple Thesaurus Bot (without wildcards, LIVE)

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

Libraryless. Click here for Pure Java version (1511L/10K/32K).

1  
!759
2  
3  
static new Map<S, S> thesaurusMap;
4  
5  
p {
6  
  load("thesaurusMap");
7  
}
8  
9  
synchronized answer {
10  
  if "add thesaurus * *" {
11  
    S key = m.unq(0), value = m.unq(1);
12  
    if (match(key, value))
13  
      ret "You nasty rascal, don't do the endless loop!";
14  
    thesaurusMap.put(key, value);
15  
    save("thesaurusMap");
16  
    ret "OK, saved! Thesaurus size now: " + l(thesaurusMap);
17  
  }
18  
  
19  
  if "thesaurus size"
20  
    ret lstr(thesaurusMap);
21  
  
22  
  if "list thesaurus"
23  
    ret structure(thesaurusMap);
24  
  
25  
  for (S key : keys(thesaurusMap))
26  
    if (match(key, s)) {
27  
      S a = askSelf(thesaurusMap.get(key));
28  
      if (nempty(a)) {
29  
        getInvolvedBots().add(formatSnippetID(programID()));
30  
        ret a;
31  
      }
32  
    }
33  
      
34  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002480
Snippet name: Simple Thesaurus Bot (without wildcards, LIVE)
Eternal ID of this version: #1002480/1
Text MD5: 6eab8852626fe0672bf3d39d42f45aa2
Transpilation MD5: 3dc5f1334f9bf9dd6a05312fc8577724
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-03 00:20:57
Source code size: 744 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 665 / 1145
Referenced in: [show references]