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

46
LINES

< > BotCompany Repo | #1008260 // Thinking Java VM [WORKS]

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

Download Jar. Libraryless. Click here for Pure Java version (10491L/73K).

!7

sS bla = [[
  meuxzrhkgzofjjby - Should I stay alive?
  qnaeuvrncafakobl - The answer to X is yes
  erxlvkdlgekomlvy - The answer to X is no
]];

p {
  myTruth_persistent = false;
  myTruth(bla);
  injectTruthBot();
  repeat with sleep 1 {
    double value = evalQuestionVerbose("Should I stay alive?");
    if (value > -0.5)
      print("Staying alive.");
    else {
      print("Killing myself in 2");
      sleepSeconds(2);
      cleanKill();
    }
  }
}

static double evalQuestionVerbose(S question) {
  Lisp l = englishToLisp(question);
  double value = 0;
  if (lispTrueVerbose(englishToLispFormat("The answer to X is yes", l)))
    value = 1;
  if (lispTrueVerbose(englishToLispFormat("The answer to X is no", l)))
    value = -1;
  print("eval: " + question + " / " + l + " => " + formatDouble(value, 1));
  ret value;
}

svoid injectTruthBot {
  bot();
}

answer {
  if (startsWithWords(s, "inject truth:", m)) {
    Lisp l = englishToLisp($1);
    fromUser(l);
    ret "Injecting: " + l;
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1008260
Snippet name: Thinking Java VM [WORKS]
Eternal ID of this version: #1008260/7
Text MD5: 74a30eb0697bc50e1cb2a1b8590903d7
Transpilation MD5: e7320339e77a9a8e94a6a419c2fe1b37
Author: stefan
Category: javax / a.i.
Type: JavaX source code (desktop)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-05-04 16:11:12
Source code size: 1053 bytes / 46 lines
Pitched / IR pitched: No / No
Views / Downloads: 368 / 780
Version history: 6 change(s)
Referenced in: [show references]