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).

!7

static JPanel form;

p {
  fS concept = 
    //"kthpatohcsbblavt"; // a human
    "dtzdwdnouygluaql"; // human
  
  time2 {
    Collection<S> pos = whatIs(concept);
    Collection<S> neg = whatIsNot(concept);
    Collection<S> other = otherAnswers(concept);
    Collection<S> unknown = listMinusList(aiConceptIDs(), concatLists(pos, neg, other));
    unknown = [S id : unknown | !containsXYZVariables(conceptToName(id))];
  }

  print("IS:");
  printAIConcepts(pos);
  print();
  print("ISN'T:");
  printAIConcepts(neg);
  print();
  print("OTHER:");
  printAIConcepts(other);
  print();
  
  /*print("UNKNOWN:");
  printAIConcepts(unknown);
  print();*/
  fS id = random(unknown);
  if (id != null) {
    final Lisp q = lisp("pyzgofzoejdprkow", id, concept);
    fS qq = "Is " + quote(conceptToName(id)) + " " + firstToLower(conceptToName(concept)) + "?";
    print(qq);
    showControls(vstackWithSpacing(jcenteredlabel(qq),
      jcenteredline(
        jbutton("Yes", r { answerWith(lisp("fgvvrzypbkqomktd", id, concept)) }),
        jbutton("No", r { answerWith(lisp("aajsjaczgasbazcu", id, concept)) }),
        //jbutton("Question makes no sense", r { answerWith(lisp("lnxlavjirjaeeuil", q)) }),
        jbutton("Other...", r { other(q, qq) })
    )));
    consoleProgramTitle();
    sleepQuietly();
  }
}

svoid answerWith(final Lisp statement) {
  disableAllButtons(getControls());
  if (form != null) { disposeFrame(form); form = null; }
  thread {
    addTruth(statement);
    clearStatementCaches(10);
    clearConsole();
    runMain();
  }
}

svoid other(final Lisp q, S qq) {
  if (form != null) ret;
  final new JTextField tf;
  form = showFormTitled("Your response",
    "Question", qq,
    "Your response", tf,
    r {
      answerWith(lisp("tlwrjpzuteopednt", q, or2(getTextTrim(tf), "?")))
    });
}

static Collection<S> otherAnswers(S concept) {
  new TreeSet<S> out;
  for (Lisp l : lispTruthByHead("tlwrjpzuteopednt")) {
    Lisp q = l.get(0);
    if (q != null && q.is("pyzgofzoejdprkow") && eq(q.rawOrNull(1), concept))
      addIfNotNull(out, q.rawOrNull(0));
  }
  ret out;
}

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