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

44
LINES

< > BotCompany Repo | #1010573 // If starts with

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

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (14300L/102K).

1  
!7
2  
3  
static L<WebNode> instructions;
4  
static volatile L<WebNode> topic;
5  
static WebNode source;
6  
7  
p {
8  
  typicalDownload();
9  
  instructions = indexedNodes("If starts with");
10  
  bot();
11  
  centerBiggerConsole();
12  
  consoleInput("What do you know about Gaga?");
13  
  askButton();
14  
}
15  
16  
answer {
17  
  if "source" ret source.web.source;
18  
  if "index" { pnl(keys(cachedNodeIndex())); ret "-"; }
19  
  
20  
  for (WebNode instruction : instructions) {
21  
    WebNode op = web_operand(instruction);
22  
    if (matchStart(web_unquote(op), s, m)) {
23  
      WebNode i = web_operand(op);
24  
      S what = web_text(i);
25  
      if (eqic(what, "get topic $1")) {
26  
        getTopic(m.rest());
27  
        ret anyFactAbout(source = first(topic));
28  
      } else
29  
        ret "huh? " + what;
30  
    }
31  
  }
32  
}
33  
34  
svoid getTopic(S topic) {
35  
  main.topic = indexedNodes(topic);
36  
  print("Got topic: " + topic + " => " + n(main.topic, "node"));
37  
}
38  
39  
sS anyFactAbout(WebNode node) {
40  
  if (node == null) ret "No idea";
41  
  Triple<WebNode, S, WebNode> t = web_mostInterestingConnection(node);
42  
  if (t == null) ret "No idea about " + node;
43  
  ret web_text(t.a) + " " + t.b + " " + web_text(t.c) + ".";
44  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1010573
Snippet name: If starts with
Eternal ID of this version: #1010573/19
Text MD5: 2699b0c060c88404d9bb7d1b2501457f
Transpilation MD5: 24fb8febac5bc944900a0f6c7538b212
Author: stefan
Category: javax
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-09-22 17:00:32
Source code size: 1159 bytes / 44 lines
Pitched / IR pitched: No / No
Views / Downloads: 443 / 15670
Version history: 18 change(s)
Referenced in: [show references]