!7 static int quads = 2; !include #1006931 // AI Game & API p-autorestart { newImageText = "New Letter!"; gameTitle = "A. I. Game 8.2"; reproZoom = 1; makeInstruction(); pGame(); swing { final JSpinner spinner = jSpinner(quads, 1, 100); addToWindowPack_keepWidth(is, withMargin(jRightAligned(withLabel("Number of quads to use:", spinner)))); onChange(spinner, r { quads = intFromSpinner(spinner); makeInstruction(); restartAIs(); }); clickButton(last(aiButtons)); // Start the winner AI! } } svoid makeInstruction { setInstruction("Reproduce this image with " + n2(quads, "quad") + ":"); } sclass Submission extends BackgroundPlus { *() {} *(BackgroundPlus b) { copyFields(b, this); check(); } void check { assertEqualsQuick(quads, l(things)); for (PolygonWithColor p : things) assertEqualsQuick(4, l(p.points)); } } !include #1014964 // Random letter puzzle maker /////////////// // RENDERERS // /////////////// static RGBImage renderImage(Submission s) { ret new RGBImage(renderImage1(s)); } static BufferedImage renderImage1(Submission s) { ret renderBackgroundPlusPolys(w, h, s); } static BufferedImage renderWithHints(Submission s) { ret renderBackgroundPlusPolys_withHints(w, h, s); } ///////////////////////////////// // AIs. Just add your own here // ///////////////////////////////// AI_Random_abstract > AI_Random { Submission guess() { ret Submission(randomBackgroundPlusPolys(w, h, quads, 4)); } } AI_RandomWithVariation_abstract > AI_RandomWithVariation { AI_RandomWithVariation() { super(new AI_Random); } Submission vary(Submission s) { ret varyBackgroundPlusPolys(s, w, h); } } !include #1014957 // AI_Racer