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

44
LINES

< > BotCompany Repo | #1001367 // Jumping Heart (jumps between two machines) with hyperMove (faster)

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

Libraryless. Click here for Pure Java version (1756L/13K/40K).

1  
!747
2  
3  
m {
4  
  static volatile long beatCount;
5  
  static volatile int delay = 1000;
6  
  static long booted;
7  
  static volatile boolean loud = true;
8  
  static int jumpEvery = 10;
9  
  
10  
  // We alternate between two machines as a test.
11  
  static S machine1 = "teubizvjbppd";
12  
  static S machine2 = "dhtvkmknsjym";
13  
  
14  
  p {
15  
    booted = now();
16  
    readLocally("beatCount");
17  
    makeAndroid3("Heart.");
18  
    print("Beat count " + beatCount + ". Beating at 1/" + delay + " ms...");
19  
    
20  
    while (true) {
21  
      if (loud)
22  
        print("beep!");
23  
      ++beatCount;
24  
      saveLocally("beatCount");
25  
      if ((beatCount % jumpEvery) == 0) {
26  
        print("Now I should be moved!");
27  
        hyperMove(machine1, machine2);
28  
        System.exit(0);
29  
      }
30  
      sleep(delay);
31  
    }
32  
  }
33  
  
34  
  static synchronized S answer(S s, L<S> history) {
35  
    if (match3("get beat count", s))
36  
      return "" + beatCount;
37  
    if (match3("get delay", s))
38  
      return "" + delay;
39  
    if (match3("booted when", s))
40  
      return "" + booted;
41  
      
42  
    return null;
43  
  }
44  
}

Author comment

Began life as a copy of #1001358

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001367
Snippet name: Jumping Heart (jumps between two machines) with hyperMove (faster)
Eternal ID of this version: #1001367/1
Text MD5: 8ab17bca2e20eaf697d87875943421c4
Transpilation MD5: ce00a53895d42a8ef87e608d6d351a90
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-11 20:54:39
Source code size: 1072 bytes / 44 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 615 / 657
Referenced in: [show references]