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

68
LINES

< > BotCompany Repo | #1014980 // A. I. Game 8.4 / Circles [OK]

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

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

!7

static int circles = 1;

!include #1015048 // AI Game & API

p-autorestart {
  newImageText = "New Letter!";
  gameTitle = "A. I. Game 8.4";
  mixReproWithImage = true;
  makeInstruction();
  pGame();
  swing {
    loadImageSnippet(#1101188); // Instagram logo
    final JSpinner spinner = jSpinner(circles, 1, 100);
    addToWindowPack_keepWidth(is, withMargin(jRightAligned(withLabel("Number of circles to use:", spinner))));
    onChange(spinner, r {
      circles = intFromSpinner(spinner);
      makeInstruction(); restartAIs();
    });

    clickButton(last(aiButtons)); // Start the winner AI!
  }
}

svoid makeInstruction {
  setInstruction("Reproduce this image with " + n2(circles, "circle") + ":");
}

sclass Submission extends BackgroundPlus<CircleWithColor> {
  *() {}
  *(BackgroundPlus<CircleWithColor> b) { copyFields(b, this); check(); }
  
  void check {
    assertEqualsQuick(circles, l(things));
  }
}

!include #1014964 // Random letter puzzle maker 

///////////////
// RENDERERS //
///////////////

static BufferedImage renderImage1(Submission s) { ret renderBackgroundPlusCircles(w, h, s); }
static BufferedImage renderWithHints(Submission s) {
  ret renderBackgroundPlusCircles_withHints(w, h, s);
}

/////////////////////////////////
// AIs. Just add your own here //
/////////////////////////////////

AI_Random_abstract > AI_Random {
  Submission guess() {
    ret Submission(randomBackgroundPlusCircles(w, h, circles));
  }
}

AI_RandomWithVariation_abstract > AI_RandomWithVariation {
  AI_RandomWithVariation() { super(new AI_Random); }
  
  Submission vary(Submission s) {
    ret varyBackgroundPlusCircles(s, w, h);
  }
}

!include #1014957 // AI_Racer

Author comment

Began life as a copy of #1014979

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: #1014980
Snippet name: A. I. Game 8.4 / Circles [OK]
Eternal ID of this version: #1014980/13
Text MD5: 59bd4f09462a5d09ee52a9545aedd27f
Transpilation MD5: 2862dd9743f8855bdebdac9d27612783
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 02:36:10
Source code size: 1756 bytes / 68 lines
Pitched / IR pitched: No / No
Views / Downloads: 510 / 1684
Version history: 12 change(s)
Referenced in: [show references]