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

40
LINES

< > BotCompany Repo | #1001358 // Jumping Heart (jumps between two machines)

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

Libraryless. Click here for Pure Java version (1646L/11K/38K).

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  
  p {
11  
    booted = now();
12  
    readLocally("beatCount");
13  
    makeAndroid3("Heart.");
14  
    print("Beat count " + beatCount + ". Beating at 1/" + delay + " ms...");
15  
    
16  
    while (true) {
17  
      if (loud)
18  
        print("beep!");
19  
      ++beatCount;
20  
      saveLocally("beatCount");
21  
      if ((beatCount % jumpEvery) == 0) {
22  
        nohupJavax(parseSnippetID("#1001351") + " " + programID());
23  
        print("Now I should be moved!");
24  
        sleep();
25  
      }
26  
      sleep(delay);
27  
    }
28  
  }
29  
  
30  
  static synchronized S answer(S s, L<S> history) {
31  
    if (match3("get beat count", s))
32  
      return "" + beatCount;
33  
    if (match3("get delay", s))
34  
      return "" + delay;
35  
    if (match3("booted when", s))
36  
      return "" + booted;
37  
      
38  
    return null;
39  
  }
40  
}

Author comment

Began life as a copy of #1001325

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: #1001358
Snippet name: Jumping Heart (jumps between two machines)
Eternal ID of this version: #1001358/1
Text MD5: 49c48dd7c58e2872af74108c987b9722
Transpilation MD5: c51675a7ff5daa15cb03617ee2004e4d
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-11 00:52:58
Source code size: 961 bytes / 40 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 602 / 637
Referenced in: [show references]