Libraryless. Compilation Failed (22306L/166K).
!7 set flag DynModule. sclass CalculationBot > DynPrintLog { bool debug; LS entities = synchroList(); LS facts = synchroList(); SS questions = synchroCIMap(); L<IfThen> rules; L<S> externalFacts; start { loadFunctions_preferCached(); dm_useLocallyCopiedMechLists(); Pair<L<IfThen>, LS> p = ai_activeRulesAndFacts(); rules = p.a; rules.addAll(ai_parseRules(mL_raw("Data structures [Script]"))); //print("Have rules:"); //pnl(rules); externalFacts = p.b; entities.add("the dawn of time"); new Thinking().step(); print("done"); } S evalExp(Exp e, NLLogicChecker_v2.Matching m) { S code = nlLogic_text(e); print("Eval'ing: " + code); S result = str(evalWithDollarVars(code, m.matches)); print("Result: " + shorten(result, 100)); ret result; } class Thinking { void step { final new NLLogicChecker_v3 c; c.entities = entities; c.evaluator = func(Exp e, NLLogicChecker_v2.Matching m) -> S { evalExp(e, m) }; c.facts = concatLists(facts, externalFacts); applyNLLogicFacts_v4(c, voidfunc(IfThen rule, NLLogicChecker_v2.Matching m) { // Rule fired! print("Firing rule " + rule.globalID); executeRule(c, RuleWithParams(rule, m.matches)); }, rules); } void executeRule(NLLogicChecker_v3 c, RuleWithParams r) { // Execute rule for (Exp e : nlLogic_unrollAnd(r.rule.out)) { e = c.apply(e, r.matches); if (e cast Func) { S name = e.name; if (eq(name, 'fact)) { S fact = nlLogic_text(e.arg); if (!containsNL(facts, fact)) facts.add(fact); } else if (eq(name, 'entity)) { S ent = nlLogic_text(e.arg); if (!containsNL(entities, ent)) { entities.add(ent); print("New entity: " + ent); } } /*else if (eq(name, 'input)) { S x = nlLogic_text(e.arg); if (!rewrittenInputs.contains(x) && newRewrittenInputs.add(x)) print("New rewritten input: " + x); } */else ret with print("Skipping rule with unknown RHS func: " + e.name); } else ret with print("Skipping rule with unknown RHS element: " + e); } } } // end class Thinking }
Began life as a copy of #1017807
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017900 |
Snippet name: | Calculation Bot v1 [Dyn Module, thinks about a topic, dev.] |
Eternal ID of this version: | #1017900/22 |
Text MD5: | 5857db5afbb59a27495446f837791e88 |
Transpilation MD5: | d40f0c1601b6f979a714d458bd266a75 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-08-21 13:59:19 |
Source code size: | 2441 bytes / 81 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 440 / 879 |
Version history: | 21 change(s) |
Referenced in: | -