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

35
LINES

< > BotCompany Repo | #1022819 // AI_CurrentTimeBot

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (7073L/47K).

1  
sclass AI_CurrentTimeBot > AttractorBot {
2  
  // MAIN FUNCTION
3  
  
4  
  void sayTime { say("It is " + localTime_24()); }
5  
  
6  
  // FLOW START
7  
  
8  
  public void run {
9  
    say("Do you want to know the current time?");
10  
    addAttractor(yes_SayTime);
11  
    addLowPrioAttractor(sayOK);
12  
  }
13  
  
14  
  // CONFIG
15  
  
16  
  *() {
17  
    standardAttractors(doItAgain, whatsTheTime, talkToMe, whatCanYouDo, thanks,
18  
      new MatchAttractor("can you do anything else", r { say("no") }),
19  
      new MatchAttractor("what else can you do", r { say("nothing") }));
20  
  }
21  
  
22  
  // ATTRACTORS
23  
  
24  
  MatchAttractor thanks = new("thanks|thank you|thx", r { say("You're welcome") });
25  
  MatchAttractor whatCanYouDo = new("what can you do...|what is your skill|who are you", r {
26  
    say("I can tell you the time");
27  
    addAttractor(doIt);
28  
  });
29  
  MatchAttractor doIt = new("do it|ok|i want that", r sayTime);
30  
  MatchAttractor talkToMe = new("talk to me|hi|talk|say something", r run_public);
31  
  MatchAttractor doItAgain = new("do it again|again|another time|do your trick again", r sayTime);
32  
  MatchAttractor whatsTheTime = new("what's the time|tell me the time|time", r sayTime);
33  
  Attractor yes_SayTime = new(f<S, Bool> isYes_1, r sayTime);
34  
  DefaultAttractor sayOK = new(r { say("OK") });
35  
}

Author comment

Began life as a copy of #1022814

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1022819
Snippet name: AI_CurrentTimeBot
Eternal ID of this version: #1022819/1
Text MD5: e055d46f71b083157812f394dae1c9bb
Transpilation MD5: ebf3a5d3c06e474459123fccdeccbfcd
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-04-09 10:58:48
Source code size: 1274 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 248 / 718
Referenced in: [show references]