Download Jar. Uses 3874K of libraries. Click here for Pure Java version (11951L/87K).
1 | !7 |
2 | |
3 | static int polys = 2, corners = 4; |
4 | |
5 | !include #1015048 // AI Game & API |
6 | |
7 | p-autorestart { |
8 | newImageText = "New Letter!"; |
9 | gameTitle = "A. I. Game 8.3"; |
10 | reproZoom = 1; |
11 | makeInstruction(); |
12 | pGame(); |
13 | swing { |
14 | final JSpinner spinner = jSpinner(polys, 1, 100); |
15 | addToWindowPack_keepWidth(is, withMargin(jRightAligned(withLabel("Number of polys to use:", spinner)))); |
16 | onChange(spinner, r { |
17 | polys = intFromSpinner(spinner); |
18 | makeInstruction(); restartAIs(); |
19 | }); |
20 | final JSpinner spinner2 = jSpinner(corners, 3, 100); |
21 | addToWindowPack_keepWidth(is, withMargin(jRightAligned(withLabel("Number of corners for each polygon:", spinner2)))); |
22 | onChange(spinner2, r { |
23 | corners = intFromSpinner(spinner2); |
24 | makeInstruction(); restartAIs(); |
25 | }); |
26 | |
27 | clickButton(last(aiButtons)); // Start the winner AI! |
28 | } |
29 | } |
30 | |
31 | svoid makeInstruction { |
32 | setInstruction("Reproduce this image with " + n2(polys, "poly") + ", each having " + corners + " corners:"); |
33 | } |
34 | |
35 | sclass Submission extends BackgroundPlus<PolygonWithColor> { |
36 | *() {} |
37 | *(BackgroundPlus<PolygonWithColor> b) { copyFields(b, this); check(); } |
38 | |
39 | void check { |
40 | assertEqualsQuick(polys, l(things)); |
41 | for (PolygonWithColor p : things) |
42 | assertEqualsQuick(corners, l(p.points)); |
43 | } |
44 | } |
45 | |
46 | !include #1014964 // Random letter puzzle maker |
47 | |
48 | /////////////// |
49 | // RENDERERS // |
50 | /////////////// |
51 | |
52 | static BufferedImage renderImage1(Submission s) { ret renderBackgroundPlusPolys(w, h, s); } |
53 | static BufferedImage renderWithHints(Submission s) { ret renderBackgroundPlusPolys_withHints(w, h, s); } |
54 | |
55 | ///////////////////////////////// |
56 | // AIs. Just add your own here // |
57 | ///////////////////////////////// |
58 | |
59 | AI_Random_abstract > AI_Random { |
60 | Submission guess() { |
61 | ret Submission(randomBackgroundPlusPolys(w, h, polys, corners)); |
62 | } |
63 | } |
64 | |
65 | AI_RandomWithVariation_abstract > AI_RandomWithVariation { |
66 | AI_RandomWithVariation() { super(new AI_Random); } |
67 | |
68 | Submission vary(Submission s) { |
69 | ret varyBackgroundPlusPolys(s, w, h); |
70 | } |
71 | } |
72 | |
73 | !include #1014957 // AI_Racer |
Began life as a copy of #1014965
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1014979 |
Snippet name: | A. I. Game 8.3 / Colored Polys [OK] |
Eternal ID of this version: | #1014979/6 |
Text MD5: | 2a7072dc1d669b939d61c38c7ff78e70 |
Transpilation MD5: | 2c84471de3f0a5d61a435dccf243609b |
Author: | stefan |
Category: | javax / gui / a.i. |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-05-09 03:12:30 |
Source code size: | 2119 bytes / 73 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 618 / 1455 |
Version history: | 5 change(s) |
Referenced in: | [show references] |