Libraryless. Click here for Pure Java version (1360L/10K/32K).
1 | !752 |
2 | |
3 | sS suckerID = "#1004698"; |
4 | |
5 | static interface Algorithm { |
6 | S predict(int max); |
7 | void feed(S s); |
8 | } |
9 | |
10 | // simple test algorithm |
11 | sclass TestAlgo implements Algorithm { |
12 | char c; |
13 | public S predict(int max) { ret str(c); } |
14 | public void feed(S s) { c = last(s); } |
15 | } |
16 | |
17 | p { |
18 | wakeSucker(suckerID, "TestAlgo", new TestAlgo); |
19 | } |
20 | |
21 | static void wakeSucker(S suckerID, S desc, Algorithm algo) { |
22 | ping(); |
23 | |
24 | print("Waking..."); |
25 | O sucker = run(suckerID); |
26 | print("Feeding..."); |
27 | |
28 | Class intrface = getClass(sucker, "main$Algorithm"); |
29 | assertNotNull("main$Algorithm", intrface); |
30 | O proxy = proxy(intrface, algo); |
31 | O result = callOpt(sucker, "suck", desc, proxy); |
32 | print("Suck Result: " + struct(result)); |
33 | |
34 | cleanUp(sucker); |
35 | } |
Began life as a copy of #1004664
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1004699 |
Snippet name: | Feed Text Predict Sucker |
Eternal ID of this version: | #1004699/1 |
Text MD5: | 6d8a46d9d285c49ff7d45758c572e281 |
Transpilation MD5: | 56d7c86d7df3259d761acd7940dce7f1 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-08-27 13:08:06 |
Source code size: | 758 bytes / 35 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 513 / 611 |
Referenced in: | [show references] |