!759 // user must include a Thinker, e.g. #1003797 // and, of course, implement makeGenerators static void solveExamples(L<S> examples) { new Thinker thinker; bool unsolved = false, partiallySolved = false, fullySolved = false; for (int i = 0; i < l(examples); i++) { setConsoleTitle("[" + (i+1) + "/" + l(examples) + "] Solving..." + " - " + getProgramTitle()); S example = examples.get(i); print("Example " + (i+1)); L<S> log = toLinesFullTrim(example); BitSet interestingLines = detectInterestingLines(log); int maxScore = interestingLines.cardinality(); MultiSet<S> scores = thinker.scores(log, interestingLines); S top = scores.getMostPopularEntry(); int score = scores.get(top); S status = null; if (score >= maxScore) { status = "Example fully solved by " + quote(top) + " (" + score + "/" + maxScore + ")!"; fullySolved = true; } else if (score > 0) { status = "Example partially solved by " + quote(top) + " (" + score + "/" + maxScore + ")"; partiallySolved = true; } else { status = "Example not solved"; unsolved = true; } print(status); } int n = l(examples); S status = fullySolved && !partiallySolved && !unsolved ? n + "/" + n + " Solved" : partiallySolved ? n + " Partially solved" : n + "/" + n + " Unsolved"; print(); print(status); setConsoleTitle(status + " - " + getProgramTitle()); }
Began life as a copy of #1003803
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1003812 |
Snippet name: | solveExamples |
Eternal ID of this version: | #1003812/1 |
Text MD5: | becfe3ecddea45cc02e9c7f5eb5845a1 |
Author: | stefan |
Category: | javax / talking robots |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-07-28 02:37:29 |
Source code size: | 1487 bytes / 44 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 567 / 555 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |