sclass ExternalTextAI { O ai; *(S progID) { S code = loadProgramTextFile(progID, "winner.text"); if (empty(code)) fail("No winner in program, please run it first: " + progID); O program = hotwire(progID); ai = unstructureInRealm(code, program); } sclass Game { S submitted; S submit(S text) { submitted = text; null; } } S call(BufferedImage img) { new Game game; pcall { O rgbImage = nuForeignObject(ai, "main$RGBImage", img); O exportedGame = proxy(_getClass(ai, "main$GameForAI"), game); set(ai, "game", exportedGame); set(ai, "image", rgbImage); callOpt(ai, "go"); if (game.submitted != null) print("AI " + shortClassName(ai) + " returned: " + game.submitted); } ret game.submitted; } } static ExternalTextAI loadWinnerTextAI(S progID) { ret new ExternalTextAI(progID); }
Began life as a copy of #1006914
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: | #1007134 |
Snippet name: | ExternalTextAI + loadWinnerTextAI |
Eternal ID of this version: | #1007134/1 |
Text MD5: | b2fdf52c725b6a7f2fce6482b2327e34 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2017-03-05 23:38:55 |
Source code size: | 938 bytes / 37 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 532 / 556 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |