Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

35
LINES

< > BotCompany Repo | #1004699 // Feed Text Predict Sucker

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (1360L/10K/32K).

!752

sS suckerID = "#1004698";

static interface Algorithm {
  S predict(int max);
  void feed(S s);
}

// simple test algorithm
sclass TestAlgo implements Algorithm {
  char c;
  public S predict(int max) { ret str(c); }
  public void feed(S s) { c = last(s); }
}

p {
  wakeSucker(suckerID, "TestAlgo", new TestAlgo);
}

static void wakeSucker(S suckerID, S desc, Algorithm algo) {
  ping();

  print("Waking...");
  O sucker = run(suckerID);
  print("Feeding...");
  
  Class intrface = getClass(sucker, "main$Algorithm");
  assertNotNull("main$Algorithm", intrface);
  O proxy = proxy(intrface, algo);
  O result = callOpt(sucker, "suck", desc, proxy);
  print("Suck Result: " + struct(result));

  cleanUp(sucker);
}

Author comment

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: 512 / 610
Referenced in: [show references]