!7 static int n, limit = 1000000; sS inputDiagrams = [[ CirclesAndLines(circles=[Circle(text="Find", x=d("0.27089337175792505"), y=d("0.18181818181818182")), Circle(text="an integer", x=d("0.5965417867435159"), y=d("0.19922630560928434")), Circle(text="odd", x=d("0.5936599423631124"), y=d("0.5145067698259188"))], lines=[Arrow(a=t5, b=t26, text=""), Arrow(a=t26, b=t47, text="that is")]) CirclesAndLines(circles=[Circle(text="A standard function that enumerates", x=d("0.3011527377521614"), y=d("0.2688588007736944")), Circle(text="integers", x=d("0.5561959654178674"), y=d("0.4448742746615087")), Circle(text="\"enumerateIntegers\"", x=d("0.7521613832853026"), y=d("0.6808510638297872"))], lines=[Arrow(a=t5, b=t26, text=""), Arrow(a=t26, b=t47, text="is")]) CirclesAndLines(circles=[Circle(text="A standard function that tests", x=d("0.3645533141210375"), y=d("0.2011605415860735")), Circle(text="an integer", x=d("0.2377521613832853"), y=d("0.5764023210831721")), Circle(text="odd", x=d("0.47982708933717577"), y=d("0.5725338491295938")), Circle(text="\"odd\"", x=d("0.7132564841498559"), y=d("0.562862669245648"))], lines=[Arrow(a=t5, b=t26, text="what"), Arrow(a=t5, b=t47, text="for property"), Arrow(a=t5, b=t68, text="is")]) ]]; p { Web web = webFromCALStructures_noMerge(inputDiagrams); showWeb(web); infoBox("Thinking..."); WebNode find = web_findNode(web, "Find"); WebNode op = web_operand(find); print("Finding: " + op); S plural = plural(dropArticle(web_text(op))); print("Plural: " + plural); Pair finder = web_findTriple(web, "A standard function that enumerates", "", plural); print("Finder: " + finder); if (finder == null) fail("No finder"); S sfName = web_operandText(finder.b, "is"); if (sfName == null) fail("No sf"); print("Using function: " + sfName); Iterator iterator = getIterator(makeAndCall(sfName)); new L testers; for (Pair p : web_forwardRelationsTextPlusNodes(op)) { //print("Condition: " + p); if (eqic(p.a, "that is")) { S property = p.b.text(); testers.add(ai_makeTester(web, web_text(op), property)); } else fail("Unknown condition: " + p); } infoBox("Iterating..."); search: while (iterator.hasNext()) { ping(); if (++n > limit) { print("Limit of " + limit + " reached, cancelling."); break; } O o = iterator.next(); for (O tester : testers) if (!isTrue(callF(tester, o))) continue search; infoBox("Answer found in step " + n + "!!! >> " + o); break; } }