!7 // too brave // rewrite Submission = BackgroundPlus. static double thresholdPercent = 0.1; // quit when less than 0.1% improvement (absolute) static int thresholdRounds = 5000; // ...in the last 5000 rounds p-experiment { S imageID = #1101217; lines = 1; showTheImage = false; loadImageSnippet(imageID); new AI_Racer ai; new L scores; while licensed { Game game = scoreAI(ai); double score = game.percentScore(); scores.add(score); print("Score: " + formatScore(score)); int lookback = thresholdRounds/rounds; int i = l(scores)-lookback-1; if (i >= 0) //if (score < max(0.01, scores.get(i))*(1+thresholdPercent/100)) { if (score < scores.get(i)+thresholdPercent) { print("No more improvement, exiting after " + l(score)*rounds + " rounds"); break; } } } static int lines = 8; !include #1015048 // AI Game & API sclass Submission extends BackgroundPlus { *() {} *(BackgroundPlus b) { copyFields(b, this); check(); } void check { assertEqualsQuick(main.lines, l(things)); } } ////////////////// // PUZZLE MAKER // ////////////////// sS lastLetter; static RGBImage makeImage() { lastLetter = randomUpperCaseLetterNotEqualTo(lastLetter); ret randomLetterImage(lastLetter, #1004568, 100); } /////////////// // RENDERERS // /////////////// static BufferedImage renderImage1(Submission s) { ret renderRenderable(w, h, s); } static BufferedImage renderWithHints(Submission s) { ret renderRenderable_withHints(w, h, s); } ////////////////////////////////////// // Test AIs. Just add your own here // ////////////////////////////////////// AI_Random_abstract > AI_Random { Submission guess() { ret Submission(randomBackgroundPlusLines(w, h, lines)); } } AI_RandomWithVariation_abstract > AI_RandomWithVariation { AI_RandomWithVariation() { super(new AI_Random); } Submission vary(Submission s) { ret varyBackgroundPlusLines(s, w, h); } } !include #1014957 // AI_Racer