!7 sS theRiddle = [[ Q: What did Magnus Carlsen eat for breakfast? ]]; sS theFacts = [[ Magnus Carlsen lives in Norway. In Norway, they eat fish. (Q: What did X eat for breakfast?) and (X lives in Y.) and (In Y, they eat Z.) => (A: Probably Z!) ]]; sS concepts = [[ ["vouwrrhtmajsgaby", "Q: X"], ["nywfcwkkcknzhmdy", "A: X"], ["zlydvmmyckgcyrak", "Magnus Carlsen"], ["verqumbshvchuquw", "Norway"], ["wvqzrhdaqnygqgll", "Fish"], ["bzvabitchqhqkldm", "In X, they eat Y."], ["pizxszvxocdluica", "What did X eat for Y?"], ["fhsukilpoasgkvcs", "X lives in Y."], ["oceicdfeiyftxuwi", "Probably X!"], ["eijdjqhyzheusetj", "(X) and (Y) and (Z) => (AA)"], //["mcoswmplpqlieruo", "(X)"], //["mwpbetwhkuuuupws", "X and Y and 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)); /*bla = lispReplaceVars(rule.get(1), matches); web.node(bla);*/ } } static bool matchConditions(L conditions, Map m, Lisp riddle) { if (empty(conditions)) true; Lisp cond = first(conditions); for (Lisp fact : concatLists(ll(riddle), facts)) { m2 = cloneMap(m); if (lispMatch_sub(cond, fact, vars, m2)) { if (matchConditions(dropFirst(conditions), m2, riddle)) { m.putAll(m2); true; } } } false; } sS getAnswer(Web web) { ret ""; } p { setConsoleInput(trim(firstLine(theRiddle))); pConsoleThoughtMachine(); } !include #1007815 // Console Thought Machine