Download Jar. Uses 3874K of libraries. Click here for Pure Java version (11846L/86K).
1  | !7  | 
2  | |
3  | static int lines = 8;  | 
4  | |
5  | !include #1015048 // AI Game & API  | 
6  | |
7  | p-autorestart {
 | 
8  | newImageText = "New Letter!";  | 
9  | gameTitle = "A. I. Game 8.8";  | 
10  | reproZoom = 1;  | 
11  | makeInstruction();  | 
12  | pGame();  | 
13  |   swing {
 | 
14  | final JSpinner spinner = jSpinner(lines, 1, 100);  | 
15  |     addToWindowPack_keepWidth(is, withMargin(jRightAligned(withLabel("Number of lines to use:", spinner))));
 | 
16  |     onChange(spinner, r {
 | 
17  | lines = intFromSpinner(spinner);  | 
18  | makeInstruction();  | 
19  | restartAIs();  | 
20  | });  | 
21  | |
22  | clickButton(last(aiButtons)); // Start the winner AI!  | 
23  | }  | 
24  | }  | 
25  | |
26  | svoid makeInstruction {
 | 
27  |   setInstruction("Reproduce this image with " + n2(lines, "line") + ":");
 | 
28  | }  | 
29  | |
30  | sclass Submission extends BackgroundPlus<LineWithColor> {
 | 
31  |   *() {}
 | 
32  |   *(BackgroundPlus<LineWithColor> b) { copyFields(b, this); check(); }
 | 
33  | |
34  |   void check {
 | 
35  | assertEqualsQuick(main.lines, l(things));  | 
36  | }  | 
37  | }  | 
38  | |
39  | //////////////////  | 
40  | // PUZZLE MAKER //  | 
41  | //////////////////  | 
42  | |
43  | sS lastLetter;  | 
44  | |
45  | static RGBImage makeImage() {
 | 
46  | lastLetter = randomUpperCaseLetterNotEqualTo(lastLetter);  | 
47  | ret randomLetterImage(lastLetter, #1004568, 100);  | 
48  | }  | 
49  | |
50  | ///////////////  | 
51  | // RENDERERS //  | 
52  | ///////////////  | 
53  | |
54  | static BufferedImage renderImage1(Submission s) {
 | 
55  | ret renderRenderable(w, h, s);  | 
56  | }  | 
57  | |
58  | static BufferedImage renderWithHints(Submission s) {
 | 
59  | ret renderRenderable_withHints(w, h, s);  | 
60  | }  | 
61  | |
62  | //////////////////////////////////////  | 
63  | // Test AIs. Just add your own here //  | 
64  | //////////////////////////////////////  | 
65  | |
66  | AI_Random_abstract > AI_Random {
 | 
67  |   Submission guess() {
 | 
68  | ret Submission(randomBackgroundPlusLines(w, h, lines));  | 
69  | }  | 
70  | }  | 
71  | |
72  | AI_RandomWithVariation_abstract > AI_RandomWithVariation {
 | 
73  |   AI_RandomWithVariation() { super(new AI_Random); }
 | 
74  | |
75  |   Submission vary(Submission s) {
 | 
76  | ret varyBackgroundPlusLines(s, w, h);  | 
77  | }  | 
78  | }  | 
79  | |
80  | !include #1014957 // AI_Racer  | 
Began life as a copy of #1015005
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: | #1015013 | 
| Snippet name: | A. I. Game 8.8 / Lines with colors [OK] | 
| Eternal ID of this version: | #1015013/6 | 
| Text MD5: | 09715322170160ec90ab35eecc9d5c64 | 
| Transpilation MD5: | 787a51b3d996fc2151282dbec73bc7ae | 
| 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-07 17:37:48 | 
| Source code size: | 1861 bytes / 80 lines | 
| Pitched / IR pitched: | No / No | 
| Views / Downloads: | 804 / 2492 | 
| Version history: | 5 change(s) | 
| Referenced in: | [show references] |