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

78
LINES

< > BotCompany Repo | #1007840 // Concept of the day Spike [WORKS]

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

Libraryless. Click here for Pure Java version (9872L/68K/229K).

1  
!7
2  
3  
static JPanel form;
4  
5  
p {
6  
  fS concept = 
7  
    //"kthpatohcsbblavt"; // a human
8  
    "dtzdwdnouygluaql"; // human
9  
  
10  
  time2 {
11  
    Collection<S> pos = whatIs(concept);
12  
    Collection<S> neg = whatIsNot(concept);
13  
    Collection<S> other = otherAnswers(concept);
14  
    Collection<S> unknown = listMinusList(aiConceptIDs(), concatLists(pos, neg, other));
15  
    unknown = [S id : unknown | !containsXYZVariables(conceptToName(id))];
16  
  }
17  
18  
  print("IS:");
19  
  printAIConcepts(pos);
20  
  print();
21  
  print("ISN'T:");
22  
  printAIConcepts(neg);
23  
  print();
24  
  print("OTHER:");
25  
  printAIConcepts(other);
26  
  print();
27  
  
28  
  /*print("UNKNOWN:");
29  
  printAIConcepts(unknown);
30  
  print();*/
31  
  fS id = random(unknown);
32  
  if (id != null) {
33  
    final Lisp q = lisp("pyzgofzoejdprkow", id, concept);
34  
    fS qq = "Is " + quote(conceptToName(id)) + " " + firstToLower(conceptToName(concept)) + "?";
35  
    print(qq);
36  
    showControls(vstackWithSpacing(jcenteredlabel(qq),
37  
      jcenteredline(
38  
        jbutton("Yes", r { answerWith(lisp("fgvvrzypbkqomktd", id, concept)) }),
39  
        jbutton("No", r { answerWith(lisp("aajsjaczgasbazcu", id, concept)) }),
40  
        //jbutton("Question makes no sense", r { answerWith(lisp("lnxlavjirjaeeuil", q)) }),
41  
        jbutton("Other...", r { other(q, qq) })
42  
    )));
43  
    consoleProgramTitle();
44  
    sleepQuietly();
45  
  }
46  
}
47  
48  
svoid answerWith(final Lisp statement) {
49  
  disableAllButtons(getControls());
50  
  if (form != null) { disposeFrame(form); form = null; }
51  
  thread {
52  
    addTruth(statement);
53  
    clearStatementCaches(10);
54  
    clearConsole();
55  
    runMain();
56  
  }
57  
}
58  
59  
svoid other(final Lisp q, S qq) {
60  
  if (form != null) ret;
61  
  final new JTextField tf;
62  
  form = showFormTitled("Your response",
63  
    "Question", qq,
64  
    "Your response", tf,
65  
    r {
66  
      answerWith(lisp("tlwrjpzuteopednt", q, or2(getTextTrim(tf), "?")))
67  
    });
68  
}
69  
70  
static Collection<S> otherAnswers(S concept) {
71  
  new TreeSet<S> out;
72  
  for (Lisp l : lispTruthByHead("tlwrjpzuteopednt")) {
73  
    Lisp q = l.get(0);
74  
    if (q != null && q.is("pyzgofzoejdprkow") && eq(q.rawOrNull(1), concept))
75  
      addIfNotNull(out, q.rawOrNull(0));
76  
  }
77  
  ret out;
78  
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1007840
Snippet name: Concept of the day Spike [WORKS]
Eternal ID of this version: #1007840/34
Text MD5: 5ca430336e8620f1c047088740015ba9
Transpilation MD5: 5c09d4d1281e3af0c11711100bf54236
Author: stefan
Category: javax / a.i.
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-04-12 17:58:03
Source code size: 2182 bytes / 78 lines
Pitched / IR pitched: No / No
Views / Downloads: 475 / 637
Version history: 33 change(s)
Referenced in: [show references]