Libraryless. Click here for Pure Java version (2064L/14K/48K).
!759 !include #1003797 // Thinker sS detect = "<< detect"; static L<S> 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<S> 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<S> 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<Gen> l, final L<S> log) { gen(l, func { "3" }); gen(l, "plus1", func { parseLong(last(log))+1 }); }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003798 |
Snippet name: | Test Random v6 Thinker |
Eternal ID of this version: | #1003798/1 |
Text MD5: | af0b1a481b4f0456a9f2232a704c3d25 |
Transpilation MD5: | 9f59a0b50c0862c085668fb752602e97 |
Author: | stefan |
Category: | javax / talking robots |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-07-27 17:48:46 |
Source code size: | 1282 bytes / 49 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 556 / 636 |
Referenced in: | [show references] |