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

34
LINES

< > BotCompany Repo | #1002995 // TB Multi Definitions Bot (dev.)

JavaX source code - run with: x30.jar

!752

static MultiMap<S, S> shortDefinitions;

p {
  load("shortDefinitions");
}

synchronized answer {
  if (!tb()) null;
  
  if "a * is a *" {
    S in = toLowerCase(m.unq(0), out = toLowerCase(m.unq(1));
    if (shortDefinitions.containsPair(in, out))
      ret "I know";
    shortDefinitions.put(in, out);
    ret "OK!";
  }
  
  if "a * is not a *" {
    S in = toLowerCase(m.unq(0));
    if (eqic(shortDefinitions.get(in), m.unq(1))) {
      shortDefinitions.remove(in);
      ret "Removed!";
    }
  }

  if "what is a *" {
    S in = toLowerCase(m.unq(0));
    S out = shortDefinitions.get(in);
    if (nempty(out))
      ret format("A * is a *", in, out);
  }
}

Author comment

Began life as a copy of #1002991

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: #1002995
Snippet name: TB Multi Definitions Bot (dev.)
Eternal ID of this version: #1002995/1
Text MD5: 75bd8e12d58aa4f2167a4b0e6fa4c880
Author: stefan
Category: eleu / nl
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-04-15 22:01:53
Source code size: 704 bytes / 34 lines
Pitched / IR pitched: No / No
Views / Downloads: 606 / 532
Referenced in: [show references]