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

46
LINES

< > BotCompany Repo | #1005285 // User's Name [Thinking About, dev.]

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Transpiled version (4785L) is out of date.

!752

concepts.

!include #1005284 // User's Name, Concepts

concept LThatsNotMyName extends LineIdea {}

p {
  loadConceptsFrom("#1005282");
  Dialog d = dialog();
  L lines = d.lines;

  for i over lines: {
    Line line = d.lines.get(i);
    if (line !instanceof UserLine) continue;
    UserLine ul = cast line;
    BotLine bl = optCast(BotLine, get(lines, i-1));
    LineIdea botIdea = bl == null ? null : bl.idea.get();
    new Matches m;
    S s = line.text;
    
    if "das ist nicht mein name" {
      interpret(ul, unique(LThatsNotMyName));
    }
    
    if (ul.idea.get() instanceof LThatsNotMyName
      && botIdea instanceof LGreet) pcall {
      UserName u = ((LGreet) botIdea).userName.get();
      if (u.usable) {
        print(quote(u.name) + " seems to be a bad name, marking not usable");
        cset(u, "usable", false);
      }
    }
  }
  
  saveConceptsBack();
}

svoid interpret(UserLine line, LineIdea idea) {
  if (eq(line.idea.get(), idea)) ret;
  bool had = line.idea.has();
  line.idea.set(idea);
  print("Line " + quote(line.text) + " " + (had ? "re-" : "")
    + "interpreted as " + shortDynamicClassName(idea));
}

Author comment

Began life as a copy of #1005282

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1005285
Snippet name: User's Name [Thinking About, dev.]
Eternal ID of this version: #1005285/2
Text MD5: 8c1bc27927cab127caffb6d548be85a3
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-07-10 14:24:21
Source code size: 1192 bytes / 46 lines
Pitched / IR pitched: No / No
Views / Downloads: 533 / 598
Version history: 1 change(s)
Referenced in: [show references]