static Puzzle makeClickPuzzle(S instruction, L images, L solutions) { ret makeClickPuzzle(instruction, null, images, solutions); } static Puzzle makeClickPuzzle(S instruction, S nullAnswer, L images, L solutions) { // select image int i = random(l(images)); RGBImage mainImage = images.get(i); Rect solution = solutions.get(i); Rect clip; if (solution != null) { // select random portion clip = selectRandomPartContaining(mainImage, solution, w, h); solution = translateRect(solution, -clip.x, -clip.y); } else { clip = selectRandomPart(mainImage, w, h); if (clip == null) fail("No fit: " + w + "/" + h + " vs " + mainImage.w() + "/" + mainImage.h()); } RGBImage img = mainImage.clip(clip); // return puzzle ret new Puzzle(instruction, nullAnswer, img, llNonNulls(solution)); }