Warning: session_start(): open(/var/lib/php/sessions/sess_slo1uid88dhhda1pft614fc04v, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
set flag DynModule.
sclass CalculationBot > DynPrintLog {
bool debug;
LS entities = synchroList();
LS facts = synchroList();
SS questions = synchroCIMap();
L externalRules;
L externalFacts;
start {
loadFunctions_preferCached();
dm_useLocallyCopiedMechLists();
externalRules = ai_activeRules();
externalRules.addAll(ai_parseRules(mL("Data structures [Script]")));
externalFacts = mL_facts();
entities.add("the dawn of time");
new Thinking().step();
}
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.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));
}, externalRules);
}
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, '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
}