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

!7

static L<WebNode> instructions;
static volatile L<WebNode> topic;
static WebNode source;

p {
  typicalDownload();
  instructions = indexedNodes("If starts with");
  bot();
  centerBiggerConsole();
  consoleInput("What do you know about Gaga?");
  askButton();
}

answer {
  if "source" ret source.web.source;
  if "index" { pnl(keys(cachedNodeIndex())); ret "-"; }
  
  for (WebNode instruction : instructions) {
    WebNode op = web_operand(instruction);
    if (matchStart(web_unquote(op), s, m)) {
      WebNode i = web_operand(op);
      S what = web_text(i);
      if (eqic(what, "get topic $1")) {
        getTopic(m.rest());
        ret anyFactAbout(source = first(topic));
      } else
        ret "huh? " + what;
    }
  }
}

svoid getTopic(S topic) {
  main.topic = indexedNodes(topic);
  print("Got topic: " + topic + " => " + n(main.topic, "node"));
}

sS anyFactAbout(WebNode node) {
  if (node == null) ret "No idea";
  Triple<WebNode, S, WebNode> t = web_mostInterestingConnection(node);
  if (t == null) ret "No idea about " + node;
  ret web_text(t.a) + " " + t.b + " " + web_text(t.c) + ".";
}

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: 577 / 15953
Version history: 18 change(s)
Referenced in: [show references]