Uses 3874K of libraries. Click here for Pure Java version (8349L/59K/208K).
!7 !include #1006931 // AI Game & API p { pGame(); } sclass Submission { Pt a, b; *() {} *(Pt *a, Pt *b) {} } extend AI { double submit(Pt a, Pt b) { ret submit(new Submission(a, b)); } } ////////////////// // PUZZLE MAKER // ////////////////// static RGBImage makeImage() { ret loadRGBImage(#1006930); } //////////////// // FORM MAKER // //////////////// static JComponent makeTheForm(final GameForAI game) { final JSpinner x1 = jSpinner(10); final JSpinner y1 = jSpinner(20); final JSpinner x2 = jSpinner(30); final JSpinner y2 = jSpinner(40); ret makeForm(+x1, +y1, +x2, +y2, callAndPass(r { game.submit(new Submission(ptFromForm(x1, y1), ptFromForm(x2, y2))); })); } static Pt ptFromForm(JTextField x, JTextField y) { ret new Pt(intFromTextField(x), intFromTextField(y)); } static Pt ptFromForm(JSpinner x, JSpinner y) { ret new Pt(intFromSpinner(x), intFromSpinner(y)); } ////////////// // RENDERER // ////////////// static RGBImage renderImage(Submission s) { BufferedImage bi = newBufferedImage(w, h, Color.white); drawRoundEdgeLine(bi, s.a, s.b, Color.black, 10); ret new RGBImage(bi); } static RGBImage renderWithHints(Submission s) { ret renderImage(s); } ////////////////////////////////////// // Test AIs. Just add your own here // ////////////////////////////////////// AI > TestAI { void go { submit(randomPoint(image()), randomPoint(image())); } }
Began life as a copy of #1006908
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: | #1006932 |
Snippet name: | pre 5 A. I. Game / Reproduce Image |
Eternal ID of this version: | #1006932/15 |
Text MD5: | 27d938e179b5aa1f8a0b16b510aa4cf0 |
Transpilation MD5: | 643be4f47e05c1344839df3dc22f02f1 |
Author: | stefan |
Category: | javax / gui |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-02-20 00:12:49 |
Source code size: | 1495 bytes / 68 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 489 / 646 |
Version history: | 14 change(s) |
Referenced in: | [show references] |