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

51
LINES

< > BotCompany Repo | #1023143 // AI_WhatDidYouDoTodayBot

JavaX fragment (include)

1  
sclass AI_WhatDidYouDoTodayBot > AttractorBot {
2  
  Long now;
3  
  S name;
4  
  
5  
  run {
6  
    say("What did you do today?");
7  
  }
8  
  
9  
  // CONFIG
10  
  
11  
  class SetNameAttractor > Attractor {
12  
    S name;
13  
    
14  
    public bool matches(S s) {
15  
      new Matches m;
16  
      if "My name is ..."
17  
        ret true with name = $1;
18  
      if "I have no name"
19  
        ret true with name = null;
20  
      false;
21  
    }
22  
    
23  
    run {
24  
      if (nempty(name) && eqic(AI_WhatDidYouDoTodayBot.this.name, name))
25  
        ret with say("I know, " + name);
26  
        
27  
      AI_WhatDidYouDoTodayBot.this.name = name;
28  
      say("Hello " + or2(name, "stranger"));
29  
    }
30  
  }
31  
  
32  
  class Attractor1 > Attractor {
33  
    public bool matches(S s) {
34  
      new Matches m;
35  
      
36  
      if "I ..." true;
37  
        
38  
      false;
39  
    }
40  
    
41  
    run {
42  
      say(nempty(name)
43  
        ? switcheroo_youToI(switcheroo_iToName(name, input))
44  
        : switcheroo(input));
45  
    }
46  
  }
47  
  
48  
  *() {
49  
    standardAttractors(new SetNameAttractor, new Attractor1);
50  
  }
51  
}

Author comment

Began life as a copy of #1022857

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: #1023143
Snippet name: AI_WhatDidYouDoTodayBot
Eternal ID of this version: #1023143/8
Text MD5: 9c8508c1ed129bd4bdf9eca3c3dd3b09
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-15 22:46:30
Source code size: 1039 bytes / 51 lines
Pitched / IR pitched: No / No
Views / Downloads: 329 / 726
Version history: 7 change(s)
Referenced in: [show references]