Download Jar. Uses 3874K of libraries. Click here for Pure Java version (13621L/102K).
1 | !7 |
2 | |
3 | static int boxes = 3; |
4 | |
5 | !include #1015048 // AI Game & API |
6 | |
7 | p-autorestart { |
8 | mixReproWithImage = false; |
9 | newImageText = "New Letter!"; |
10 | gameTitle = "A. I. Game 8"; |
11 | reproZoom = 1; |
12 | makeInstruction(); |
13 | pGame(); |
14 | swing { |
15 | final JSpinner spinner = jSpinner(boxes, 1, 100); |
16 | addToWindowPack_keepWidth(is, withMargin(jRightAligned(withLabel("Number of boxes to use:", spinner)))); |
17 | onChange(spinner, r { |
18 | boxes = intFromSpinner(spinner); |
19 | makeInstruction(); |
20 | restartAIs(); |
21 | }); |
22 | |
23 | clickButton(last(aiButtons)); // Start the winner AI! |
24 | } |
25 | } |
26 | |
27 | svoid makeInstruction { |
28 | setInstruction("Reproduce this image with " + n2(boxes, "box", "boxes") + ":"); |
29 | } |
30 | |
31 | sclass Submission extends BackgroundPlus<BoxWithColor> { |
32 | *() {} |
33 | *(BackgroundPlus<BoxWithColor> b) { copyFields(b, this); check(); } |
34 | |
35 | void check { |
36 | assertEqualsQuick(main.boxes, l(things)); |
37 | } |
38 | } |
39 | |
40 | ////////////////// |
41 | // PUZZLE MAKER // |
42 | ////////////////// |
43 | |
44 | sS lastLetter; |
45 | |
46 | static RGBImage makeImage() { |
47 | lastLetter = randomUpperCaseLetterNotEqualTo(lastLetter); |
48 | ret randomLetterImage(lastLetter, #1004568, 100); |
49 | } |
50 | |
51 | /////////////// |
52 | // RENDERERS // |
53 | /////////////// |
54 | |
55 | static BufferedImage renderImage1(Submission s) { |
56 | ret renderRenderable(w, h, s); |
57 | } |
58 | |
59 | static BufferedImage renderWithHints(Submission s) { |
60 | ret renderRenderable/*_withHints*/(w, h, s); |
61 | } |
62 | |
63 | ////////////////////////////////////// |
64 | // Test AIs. Just add your own here // |
65 | ////////////////////////////////////// |
66 | |
67 | AI_Random_abstract > AI_Random { |
68 | Submission guess() { |
69 | ret Submission(randomBackgroundPlusBoxes(w, h, boxes)); |
70 | } |
71 | } |
72 | |
73 | AI_RandomWithVariation_abstract > AI_RandomWithVariation { |
74 | AI_RandomWithVariation() { super(new AI_Random); } |
75 | |
76 | Submission vary(Submission s) { |
77 | ret varyBackgroundPlusBoxes(s, w, h); |
78 | } |
79 | } |
80 | |
81 | !include #1014957 // AI_Racer |
Began life as a copy of #1014939
download show line numbers debug dex old transpilations
Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1019339 |
Snippet name: | A. I. Game 8 / Colored Boxes [showing actual boxes, OK] |
Eternal ID of this version: | #1019339/4 |
Text MD5: | 13e79e0e2df5351d4048f511d76819f5 |
Transpilation MD5: | d0a663bf7b0439491c8abf5d6fb2516d |
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-11-02 15:42:59 |
Source code size: | 1899 bytes / 81 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 456 / 1123 |
Version history: | 3 change(s) |
Referenced in: | [show references] |