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

26
LINES

< > BotCompany Repo | #1001310 // Leo logic

JavaX fragment (include)

static synchronized S answer(S s, L<S> history) {
  if (match3("wie hei\u00dft du", s))
    return "Leopold";
  
  if (match3("wie ist deutschland", s)) {
    unhappy();
    return "es ist h\u00e4sslich";
  }
  
  if (match3("wie ist \u00f6sterreich", s)) {
    happy();
    return "es ist sehr sch\u00f6n";
  }
    
  /*if (match3("du bist lustig", s)) {
    happy();
    return "danke sch\u00f6n";
  }*/
  
  // user input plus last Leo output and last user input
  S bla = structure(history.subList(Math.max(0, history.size()-3), history.size()));
  S answer = sendToRemoteBot("Leo Bot", "!" + bla);
  happy(); 
   
  return answer;
}

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: #1001310
Snippet name: Leo logic
Eternal ID of this version: #1001310/1
Text MD5: 4fa96340eb7b455d0099049c7f7c0074
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-09 17:03:53
Source code size: 662 bytes / 26 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 630 / 1013
Referenced in: [show references]