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

35
LINES

< > BotCompany Repo | #1009831 // "Every Day Bot" [dev.]

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

Download Jar. Uses 4489K of libraries. Click here for Pure Java version (13878L/98K).

1  
!7
2  
3  
static Web web;
4  
static Canvas canvas;
5  
6  
svoid initWeb { web.node("Every day"); }
7  
8  
p-subst {
9  
  web = persistentObject("Web", Web);
10  
  web.useCLParse = false;
11  
  web.onNewLabel.add(voidfunc(WebNode node, O label) {
12  
    processNode(node);
13  
    change();
14  
  });
15  
  initWeb();
16  
  
17  
  canvas = showCAL(webToCAL(web), 650, 450);
18  
  calcOnConceptChanges(1000, r { canvas = showCAL(webToCAL(web), canvas) }, false);
19  
  botWithCommandList("Every Day Bot.");
20  
}
21  
22  
answer {
23  
  if "every day *" {
24  
    web.relation("Every day", "I should", $1);
25  
    ret "OK";
26  
  }
27  
  if "clear" { web.clear(); change(); initWeb(); ret "OK"; }
28  
  if "add day *" { web.node($1).addLabel("Day"); ret "OK"; }
29  
  if "process" { web_processAllNodes(web); ret "OK"; }
30  
}
31  
32  
svoid processNode(WebNode node) { if (node.hasLabel("Day")) processDay(node); }
33  
svoid processDay(WebNode day) {
34  
  web_copyForwardRelations(web, "Every day", day, "I should");
35  
}

Author comment

Began life as a copy of #1009821

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: #1009831
Snippet name: "Every Day Bot" [dev.]
Eternal ID of this version: #1009831/22
Text MD5: d431bb49e582275c17401da72529ad95
Transpilation MD5: 51c920d699e28154ad92643dcec6dada
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-08-21 15:33:14
Source code size: 930 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 744 / 1645
Version history: 21 change(s)
Referenced in: [show references]