!7 !include #1006891 // AI Game & API p { instruction = "Close the window:"; pGame(); } ////////////////////////////////////// // Test AIs. Just add your own here // ////////////////////////////////////// AI > ClickAnyBLOB { static ImageSurface is; void go { L blobs = segment(image); is = showImage(is, "BLOBS", rgbMarkedRects(image, blobs)); submit(random(blobs)); } } !include #1006892 // MemorizeBrightBLOB ////////////////// // PUZZLE MAKER // ////////////////// static L mainImages; static Puzzle makePuzzle() { if (mainImages == null) mainImages = loadImages(#1006879, #1006889); L solutions = ll( pointsRect(522, 162, 540, 179), pointsRect(449, 70, 466, 84)); // select image int i = random(l(mainImages)); RGBImage mainImage = mainImages.get(i); Rect solution = solutions.get(i); // select random portion Rect clip = selectRandomPartContaining(mainImage, solution, w, h); RGBImage img = mainImage.clip(clip); solution = translateRect(solution, -clip.x, -clip.y); // return puzzle ret new Puzzle(img, ll(solution)); }