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

!7

sS theRiddle = [[

  X is the first word in my text.
  Is my text a letter or a program?
  
]];

sS theFacts = [[

  "!" is a typical first word in a program.
  "Hello" is a typical first word in a letter.
  cdtwmxtqspigpyap confirms mibnjwgfxnetaxyz.
  
]];

sS concepts = [[
  ["zcprevyllqdmyvcn", "Is X a Y or a Z?"],
  ["mibnjwgfxnetaxyz", "X is the first word in Y."],
  ["cdtwmxtqspigpyap", "X is a typical first word in a Y."],
  ["kdpoqkaoypqenusd", "X confirms Y."]
]];

static JTextArea ta;
static new L<Lisp> facts;
static * computer = new ReliableSingleThread(f think);

p-substance-noconsole {
  aiEnhancements();
  useConceptsDump(concepts);
  printNumberedLines(facts = clParse(linesToCL(theFacts)));
  onChangeAndNow(ta = showText(""), r { computer.go() });
}

svoid think {
  time {
    S w = firstWord2(getText(ta));
    S riddle = formatXYZ(theRiddle, quote(w));
    S type = conceptToName(solveRiddle(riddle(facts, riddle)));
    titleStatus_trailing(ta, empty(type) ? null : "Writing a " + type);
  }
}

static S solveRiddle(L<Lisp> facts) {
  // Find the question
  Lisp q = assertNotNull("No question found", findHead(facts, "zcprevyllqdmyvcn"));
  L<S> candidates = ll(q.s(1), q.s(2));
  ret web_candidateWithMostConfirms(facts, q.s(0), candidates);
}

!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: 762 / 2137
Version history: 82 change(s)
Referenced in: [show references]