Uses 3874K of libraries. Click here for Pure Java version (9312L/67K/233K).
!7 !include #1007130 // AI Game Include p { blunderFPS = 1001; // show all blunders pGame(); } ////////////////////////////////////// // Test AIs. Just add your own here // ////////////////////////////////////// AI > HorizontalAutoSplit { ExternalTextAI letterAI; static ImageSurface is; long lastUpdate; *() { loading { letterAI = loadWinnerTextAI(#1007131); } setOpt(letterAI.ai, lax := true); } void go { horizontalAutoSplit2_threshold = 0.3f; L<BWImage> letters = horizontalAutoSplitToImages(new BWImage(image())); new StringBuilder buf; for (BWImage img : letters) buf.append(letterAI.call(img.getBufferedImage())); if (!submitCorrectly(str(buf))) { //if (sysNow() > lastUpdate+500) { lastUpdate = sysNow(); is = showZoomedImage_centered(is, "Horizontal Split", mergeBWImagesHorizontally(letters).toRGB()); } } } AI > TryAllSplits { ExternalTextAI letterAI; static ImageSurface is; *() { loading { letterAI = loadWinnerTextAI(#1007131); } setOpt(letterAI.ai, lax := true); } void go { int w = w(), mid = w/2; BWImage bw = bwImage(); Best<Pair<S, L<Rect>>> best = new Best; for (int splitPoint = 1; splitPoint < w; splitPoint++) { Rect l = bwAutoCropClip(bw, new Rect(0, 0, splitPoint, h())); Rect r = bwAutoCropClip(bw, new Rect(splitPoint, 0, w-splitPoint, h())); S cl = letterAI.call(bw.clip(l).getBufferedImage()); float confidence = getFloat(letterAI.ai, "confidence"); S cr = letterAI.call(bw.clip(r).getBufferedImage()); confidence += getFloat(letterAI.ai, "confidence"); best.put(pair(cl + cr, ll(l, r)), confidence); } if (!submitCorrectly(best.get().a)) is = showZoomedImage_centered(is, "Best Horizontal Split", mergeImagePartsHorizontally(image(), best.get().b)); } } ////////////////// // PUZZLE MAKER // ////////////////// static Puzzle makePuzzle() { S text = randomID(2); ret new Puzzle("Enter the lowercase text you see:", renderSourceCode_1(text), text); }
Began life as a copy of #1007131
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1007132 |
Snippet name: | A. I. Game 6.2 / Recognize 2 Letters [solved 95%] |
Eternal ID of this version: | #1007132/24 |
Text MD5: | fd248761adac3c49d0b79655f9e3f08e |
Transpilation MD5: | 78a56d7ca73cd739e3cd24c760f3c7ab |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-06 15:00:43 |
Source code size: | 2134 bytes / 72 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 575 / 776 |
Version history: | 23 change(s) |
Referenced in: | [show references] |