Warning: session_start(): open(/var/lib/php/sessions/sess_v7dhg572vovq45jnh0fmr8r9cj, 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
sS theRiddle = [[
Was hatte Magnus Carlsen zum Frühstück?
]];
sS theFacts = [[
Magnus Carlsen wohnt in Norwegen.
In Norwegen isst man Fisch.
Jan Gustafsson wohnt in Deutschland.
In Deutschland isst man Bratwurst.
(Q: Was hatte X zum Frühstück?) und (X wohnt in Y.) und (In Y isst man Z.) => (A: Wahrscheinlich Z!)
]];
sS concepts = [[
["vouwrrhtmajsgaby", "Q: X"],
["nywfcwkkcknzhmdy", "A: X"],
["bzvabitchqhqkldm", "In X isst man Y."],
["pizxszvxocdluica", "Was hatte X zum Y?"],
["fhsukilpoasgkvcs", "X wohnt in Y."],
["oceicdfeiyftxuwi", "Wahrscheinlich X!"],
["eijdjqhyzheusetj", "(X) und (Y) und (Z) => (AA)"],
]];
svoid createWeb(Web web, Lisp riddle) {}
svoid calc(Web web, Lisp riddle) {
//print("Vars: " + vars);
for (LispStatement ls : lispStatementsByHead("eijdjqhyzheusetj")) {
Lisp rule = ls.term;
L conditions = dropLast(rule.args);
Lisp out = last(rule.args);
new Map matches;
if (matchConditions(conditions, matches, riddle)) {
//print("Yo! " + struct(matches));
web.node(lispReplaceVars(out, matches));
}
}
}
static bool matchConditions(L conditions, Map m, Lisp riddle) {
if (empty(conditions)) true;
Lisp cond = first(conditions);
for (Lisp fact : concatLists(ll(riddle), facts)) {
Map m2 = cloneMap(m);
if (lispMatchIC_sub(cond, fact, vars, m2)) {
if (matchConditions(dropFirst(conditions), m2, riddle)) {
m.putAll(m2);
true;
}
}
}
false;
}
sS getAnswer(Web web) {
Lisp l = web_nodeByHead(web, "nywfcwkkcknzhmdy");
if (l != null)
ret crazyEnglishFixing(conceptLanguageToEnglish_rec(l.get(0)));
null;
}
p {
setConsoleInput(firstLineFullTrim(theRiddle));
pConsoleThoughtMachine();
}
!include #1007815 // Console Thought Machine