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.

1  
!752
2  
3  
concepts.
4  
5  
!include #1005284 // User's Name, Concepts
6  
7  
concept LThatsNotMyName extends LineIdea {}
8  
9  
p {
10  
  loadConceptsFrom("#1005282");
11  
  Dialog d = dialog();
12  
  L lines = d.lines;
13  
14  
  for i over lines: {
15  
    Line line = d.lines.get(i);
16  
    if (line !instanceof UserLine) continue;
17  
    UserLine ul = cast line;
18  
    BotLine bl = optCast(BotLine, get(lines, i-1));
19  
    LineIdea botIdea = bl == null ? null : bl.idea.get();
20  
    new Matches m;
21  
    S s = line.text;
22  
    
23  
    if "das ist nicht mein name" {
24  
      interpret(ul, unique(LThatsNotMyName));
25  
    }
26  
    
27  
    if (ul.idea.get() instanceof LThatsNotMyName
28  
      && botIdea instanceof LGreet) pcall {
29  
      UserName u = ((LGreet) botIdea).userName.get();
30  
      if (u.usable) {
31  
        print(quote(u.name) + " seems to be a bad name, marking not usable");
32  
        cset(u, "usable", false);
33  
      }
34  
    }
35  
  }
36  
  
37  
  saveConceptsBack();
38  
}
39  
40  
svoid interpret(UserLine line, LineIdea idea) {
41  
  if (eq(line.idea.get(), idea)) ret;
42  
  bool had = line.idea.has();
43  
  line.idea.set(idea);
44  
  print("Line " + quote(line.text) + " " + (had ? "re-" : "")
45  
    + "interpreted as " + shortDynamicClassName(idea));
46  
}

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