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

1  
!7
2  
3  
sS bla = [[
4  
  meuxzrhkgzofjjby - Should I stay alive?
5  
  qnaeuvrncafakobl - The answer to X is yes
6  
  erxlvkdlgekomlvy - The answer to X is no
7  
]];
8  
9  
p {
10  
  myTruth_persistent = false;
11  
  myTruth(bla);
12  
  injectTruthBot();
13  
  repeat with sleep 1 {
14  
    double value = evalQuestionVerbose("Should I stay alive?");
15  
    if (value > -0.5)
16  
      print("Staying alive.");
17  
    else {
18  
      print("Killing myself in 2");
19  
      sleepSeconds(2);
20  
      cleanKill();
21  
    }
22  
  }
23  
}
24  
25  
static double evalQuestionVerbose(S question) {
26  
  Lisp l = englishToLisp(question);
27  
  double value = 0;
28  
  if (lispTrueVerbose(englishToLispFormat("The answer to X is yes", l)))
29  
    value = 1;
30  
  if (lispTrueVerbose(englishToLispFormat("The answer to X is no", l)))
31  
    value = -1;
32  
  print("eval: " + question + " / " + l + " => " + formatDouble(value, 1));
33  
  ret value;
34  
}
35  
36  
svoid injectTruthBot {
37  
  bot();
38  
}
39  
40  
answer {
41  
  if (startsWithWords(s, "inject truth:", m)) {
42  
    Lisp l = englishToLisp($1);
43  
    fromUser(l);
44  
    ret "Injecting: " + l;
45  
  }
46  
}

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: 377 / 801
Version history: 6 change(s)
Referenced in: [show references]