!7 p { MouseMover mover = new MouseMover().enable(); ExternalAI winner = loadWinnerAI(#1006908); print("Winner: " + winner); print("Structure: " + structure(winner)); BufferedImage img = shootScreen2(); Pt p = winner.call(img); if (p == null) infoMessage("No dice!"); else { mover.moveMouse(p); mover.click(); } } sclass ExternalAI { O ai; *(S progID) { S code = loadProgramTextFile(progID, "winner.text"); if (empty(code)) fail("No winner in program: " + progID); O program = hotwire(progID); ai = unstructureInRealm(code, program); } Pt call(BufferedImage img) { O rgbImage = nuForeignObject(ai, "main$RGBImage", img); new Game game; O exportedGame = proxy(_getClass(ai, "main$GameForAI"), game); set(ai, "game", exportedGame); set(ai, "image", rgbImage); callOpt(ai, "go"); print("Point: " + game.submitted); ret game.submitted; } } sclass Game { Pt submitted; L submit(O point) { submitted = (Pt) quickImport(point); null; } } static ExternalAI loadWinnerAI(S progID) { ret new ExternalAI(progID); }