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

52
LINES

< > BotCompany Repo | #1007649 // Demo 1: Smart Editor [WORKS]

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

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

1  
!7
2  
3  
sS theRiddle = [[
4  
5  
  X is the first word in my text.
6  
  Is my text a letter or a program?
7  
  
8  
]];
9  
10  
sS theFacts = [[
11  
12  
  "!" is a typical first word in a program.
13  
  "Hello" is a typical first word in a letter.
14  
  cdtwmxtqspigpyap confirms mibnjwgfxnetaxyz.
15  
  
16  
]];
17  
18  
sS concepts = [[
19  
  ["zcprevyllqdmyvcn", "Is X a Y or a Z?"],
20  
  ["mibnjwgfxnetaxyz", "X is the first word in Y."],
21  
  ["cdtwmxtqspigpyap", "X is a typical first word in a Y."],
22  
  ["kdpoqkaoypqenusd", "X confirms Y."]
23  
]];
24  
25  
static JTextArea ta;
26  
static new L<Lisp> facts;
27  
static * computer = new ReliableSingleThread(f think);
28  
29  
p-substance-noconsole {
30  
  aiEnhancements();
31  
  useConceptsDump(concepts);
32  
  printNumberedLines(facts = clParse(linesToCL(theFacts)));
33  
  onChangeAndNow(ta = showText(""), r { computer.go() });
34  
}
35  
36  
svoid think {
37  
  time {
38  
    S w = firstWord2(getText(ta));
39  
    S riddle = formatXYZ(theRiddle, quote(w));
40  
    S type = conceptToName(solveRiddle(riddle(facts, riddle)));
41  
    titleStatus_trailing(ta, empty(type) ? null : "Writing a " + type);
42  
  }
43  
}
44  
45  
static S solveRiddle(L<Lisp> facts) {
46  
  // Find the question
47  
  Lisp q = assertNotNull("No question found", findHead(facts, "zcprevyllqdmyvcn"));
48  
  L<S> candidates = ll(q.s(1), q.s(2));
49  
  ret web_candidateWithMostConfirms(facts, q.s(0), candidates);
50  
}
51  
52  
!include #1007660 // Web v1

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007649
Snippet name: Demo 1: Smart Editor [WORKS]
Eternal ID of this version: #1007649/83
Text MD5: dc8d5eeed01eae1873c38fd50e1d41c1
Transpilation MD5: aa777c1352e84bd76d84418ab67a7510
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-04-02 16:50:43
Source code size: 1359 bytes / 52 lines
Pitched / IR pitched: No / No
Views / Downloads: 772 / 2152
Version history: 82 change(s)
Referenced in: [show references]