!7 !include #1006931 // AI Game & API p { pGame(); } sclass Line { Pt a, b; *() {} *(Pt *a, Pt *b) {} } sclass Submission { new L lines; *() {} *(Line... lines) { this.lines = asList(lines); } } ////////////////// // PUZZLE MAKER // ////////////////// static RGBImage makeImage() { ret loadRGBImage(/*#1006930*/#1006944); } //////////////// // FORM MAKER // //////////////// static JComponent makeTheForm(final GameForAI game) { null; // TODO } 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); for (Line l : s.lines) drawRoundEdgeLine(bi, l.a, l.b, Color.black, 10); ret new RGBImage(bi); } ////////////////////////////////////// // Test AIs. Just add your own here // ////////////////////////////////////// AI > TestAI { static Line randomLine() { ret new Line(randomPoint(), randomPoint()); } static Pt randomPoint() { ret main.randomPoint(image()); } void go { submit(new Submission(randomLine(), randomLine(), randomLine())); } }