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

22
LINES

< > BotCompany Repo | #1008050 // OneBitBot Test [OK, but we need more "bits"]

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

Libraryless. Click here for Pure Java version (1115L/8K/27K).

!7

enum Bit { yes, no, unknown }

sclass OneBitBot {
  new TreeMap<S, Bit> examples;
  
  void yes(S s) { examples.put(s, Bit.yes); }
  void no(S s) { examples.put(s, Bit.no); }
  
  Bit get(S s) {
    ret examples.get(levenClosestIC(examples, s));
  }
}

p {
  new OneBitBot bot;
  bot.yes("yes");
  bot.no("no");
  print(bot.get("yessss"));
  print(bot.get("nooooo"));
}

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: #1008050
Snippet name: OneBitBot Test [OK, but we need more "bits"]
Eternal ID of this version: #1008050/6
Text MD5: 2bbb920232847712ef64ed8cc3f03aba
Transpilation MD5: d42b273e66a48a1105f9972710993125
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-23 00:08:37
Source code size: 394 bytes / 22 lines
Pitched / IR pitched: No / No
Views / Downloads: 404 / 442
Version history: 5 change(s)
Referenced in: [show references]