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

37
LINES

< > BotCompany Repo | #1004700 // Unit-Test Text Predict Sucker

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

Libraryless. Click here for Pure Java version (1331L/9K/31K).

!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); }
}

static O sucker;

p {
  sucker = run(suckerID);
  testAlgo(new TestAlgo);
}

static void testAlgo(Algorithm algo) {
  ping();

  Class intrface = getClass(sucker, "main$Algorithm");
  assertNotNull("main$Algorithm", intrface);
  O proxy = proxy(intrface, algo);
  double score = cast call(sucker, "scoreAlgorithm", proxy);
  print("Score for \* algo */: \* formatDouble(score, 3) */");
  
  S predicted = str(getOpt(sucker, "buf"));
  print("===");
  print(substring(predicted, 0, 1000));
  print("===");
}

Author comment

Began life as a copy of #1004699

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: #1004700
Snippet name: Unit-Test Text Predict Sucker
Eternal ID of this version: #1004700/1
Text MD5: 25d1e560028fe6ff6f12a9f92ea80522
Transpilation MD5: 0d505e566df54e205efe2fe420f737a8
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:16:56
Source code size: 811 bytes / 37 lines
Pitched / IR pitched: No / No
Views / Downloads: 519 / 594
Referenced in: