Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

67
LINES

< > BotCompany Repo | #1014991 // A. I. Game 8.5 / Circles Near Center [OK]

JavaX source code (desktop) [tags: use-pretranspiled] - run with: x30.jar

Download Jar. Uses 3874K of libraries. Click here for Pure Java version (11833L/85K).

1  
!7
2  
3  
static int circles = 1;
4  
5  
!include #1006931 // AI Game & API
6  
7  
p-autorestart {
8  
  newImageText = "New Letter!";
9  
  gameTitle = "A. I. Game 8.5";
10  
  reproZoom = 1;
11  
  makeInstruction();
12  
  pGame();
13  
  swing {
14  
    setImage(toRGBImage(toBWImage(loadImage(#1101188)))); // Instagram logo
15  
    final JSpinner spinner = jSpinner(circles, 1, 100);
16  
    addToWindowPack_keepWidth(is, withMargin(jRightAligned(withLabel("Number of circles to use:", spinner))));
17  
    onChange(spinner, r {
18  
      circles = intFromSpinner(spinner);
19  
      makeInstruction(); restartAIs();
20  
    });
21  
22  
    clickButton(last(aiButtons)); // Start the winner AI!
23  
  }
24  
}
25  
26  
svoid makeInstruction {
27  
  setInstruction("Reproduce this image with " + n2(circles, "circle") + ":");
28  
}
29  
30  
sclass Submission extends BackgroundPlus<CircleWithColor> {
31  
  *() {}
32  
  *(BackgroundPlus<CircleWithColor> b) { copyFields(b, this); check(); }
33  
  
34  
  void check {
35  
    assertEqualsQuick(circles, l(things));
36  
  }
37  
}
38  
39  
!include #1014964 // Random letter puzzle maker 
40  
41  
///////////////
42  
// RENDERERS //
43  
///////////////
44  
45  
static RGBImage renderImage(Submission s) { ret new RGBImage(renderImage1(s)); }
46  
static BufferedImage renderImage1(Submission s) { ret renderBackgroundPlusCircles(w, h, s); }
47  
static BufferedImage renderWithHints(Submission s) { ret renderBackgroundPlusCircles_withHints(w, h, s); }
48  
49  
/////////////////////////////////
50  
// AIs. Just add your own here //
51  
/////////////////////////////////
52  
53  
AI_Random_abstract > AI_Random {
54  
  Submission guess() {
55  
    ret Submission(randomBackgroundPlusCirclesNearCenter(w, h, circles));
56  
  }
57  
}
58  
59  
AI_RandomWithVariation_abstract > AI_RandomWithVariation {
60  
  AI_RandomWithVariation() { super(new AI_Random); }
61  
  
62  
  Submission vary(Submission s) {
63  
    ret varyBackgroundPlusCirclesNearCenter(s, w, h);
64  
  }
65  
}
66  
67  
!include #1014957 // AI_Racer

Author comment

Began life as a copy of #1014980

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: #1014991
Snippet name: A. I. Game 8.5 / Circles Near Center [OK]
Eternal ID of this version: #1014991/5
Text MD5: 236a62ba472d1d4ff6da3a08e5b93265
Transpilation MD5: 3d0ca30fb8ed15223e97bf9d56a32f0c
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-06 20:43:19
Source code size: 1869 bytes / 67 lines
Pitched / IR pitched: No / No
Views / Downloads: 430 / 1181
Version history: 4 change(s)
Referenced in: [show references]