!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())); } }