!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 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>> 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); }