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

18
LINES

< > BotCompany Repo | #1008066 // SelectBot using "match" method

JavaX fragment (include)

sclass SelectBot extends Concept {
  new TreeMap<S, Bool> examples;
  new TreeMap<S, Bool> guessed;
  transient S lastMatch; // not used
  
  void put(S s, Bool value) {
    examples.put(s, value);
    guessed.remove(s);
    change();
  }

  Bool get(S s) {
    Bool value = guess_match(filterByValue(examples, Bool.TRUE), s);
    if (neq(examples.get(s), value))
      if (mapPutIfChange(guessed, s, value)) change();
    ret value;
  }
}

Author comment

Began life as a copy of #1008054

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008066
Snippet name: SelectBot using "match" method
Eternal ID of this version: #1008066/5
Text MD5: d4ff6c885f21acf5bf526ac965e52800
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-23 13:57:16
Source code size: 456 bytes / 18 lines
Pitched / IR pitched: No / No
Views / Downloads: 447 / 768
Version history: 4 change(s)
Referenced in: #1008059 - Celestia Slack Bot 2 [LIVE, multiple modules]
#1013777 - Electron Slack Bot [dev.]