!759 !include #1003797 // Thinker sS detect = "<< detect"; static L log = toLinesFullTrim([[ 1 2 3 << detect 4 << detect 5 << detect ]]); p { new Thinker thinker; BitSet interestingLines = detectInterestingLines(log); int maxScore = interestingLines.cardinality(); print("Interesting lines: " + interestingLines + "(" + maxScore + ")"); psl(log); MultiSet scores = thinker.scores(log, interestingLines); S top = scores.getMostPopularEntry(); int score = scores.get(top); if (score >= maxScore) print("Fully solved by " + quote(top) + " (" + score + "/" + maxScore + ")!"); else if (score > 0) print("Partially solved by " + quote(top) + " (" + score + "/" + maxScore + ")!"); else print("Not solved at all."); } // removes the markers from the log! static BitSet detectInterestingLines(L log) { new BitSet bs; for (int i = 0; i < l(log); i++) if (endsWith(log.get(i), detect)) { bs.set(i); log.set(i, dropSuffixAndTrim(detect, log.get(i))); } ret bs; } // CREATIVE PART! // put func {}'s returning a string in there static void makeGenerators(L l, final L log) { gen(l, func { "3" }); gen(l, "plus1", func { parseLong(last(log))+1 }); }