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

51
LINES

< > BotCompany Repo | #1023143 // AI_WhatDidYouDoTodayBot

JavaX fragment (include)

sclass AI_WhatDidYouDoTodayBot > AttractorBot {
  Long now;
  S name;
  
  run {
    say("What did you do today?");
  }
  
  // CONFIG
  
  class SetNameAttractor > Attractor {
    S name;
    
    public bool matches(S s) {
      new Matches m;
      if "My name is ..."
        ret true with name = $1;
      if "I have no name"
        ret true with name = null;
      false;
    }
    
    run {
      if (nempty(name) && eqic(AI_WhatDidYouDoTodayBot.this.name, name))
        ret with say("I know, " + name);
        
      AI_WhatDidYouDoTodayBot.this.name = name;
      say("Hello " + or2(name, "stranger"));
    }
  }
  
  class Attractor1 > Attractor {
    public bool matches(S s) {
      new Matches m;
      
      if "I ..." true;
        
      false;
    }
    
    run {
      say(nempty(name)
        ? switcheroo_youToI(switcheroo_iToName(name, input))
        : switcheroo(input));
    }
  }
  
  *() {
    standardAttractors(new SetNameAttractor, new Attractor1);
  }
}

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: 327 / 723
Version history: 7 change(s)
Referenced in: [show references]