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

67
LINES

< > BotCompany Repo | #1001441 // Jumping Heart (jumps between two machines) with window

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

Libraryless. Click here for Pure Java version (2999L/20K/65K).

1  
!747
2  
!image classes
3  
4  
m {
5  
  static volatile long beatCount;
6  
  static volatile int delay = 1000;
7  
  static long booted;
8  
  //static volatile boolean loud = true;
9  
  static int jumpEvery = 10;
10  
  static boolean loud = false;
11  
  
12  
  // We alternate between two machines as a test.
13  
  static S machine1 = "teubizvjbppd";
14  
  static S machine2 = "dhtvkmknsjym";
15  
  
16  
  static ShowBigText sbt;
17  
  static int delay = 1000;
18  
  static int gfxDelay = 100;
19  
  
20  
  !include #1001425 // ShowBigText
21  
  
22  
  p {
23  
    booted = now();
24  
    readLocally("beatCount");
25  
    makeAndroid3("Heart.");
26  
    print("Beat count " + beatCount + ". Beating at 1/" + delay + " ms...");
27  
    
28  
    sbt = new ShowBigText;
29  
    sbt.title = "Jumping Heart";
30  
    sbt.showText("" + beatCount);
31  
    
32  
    awt {
33  
      moveDown(getFrame(sbt.is), 100);
34  
    }
35  
    
36  
    while (true) {
37  
      if (loud)
38  
        print("beep!");
39  
      ++beatCount;
40  
      saveLocally("beatCount");
41  
      
42  
      for (float i = 1.0f; i >= 0; i -= gfxDelay/(float) delay) {
43  
        sbt.foreground = Color.white;
44  
        sbt.background = new Color(0f, i*0.8f, 0f);
45  
        sbt.showText("" + beatCount);
46  
        sleep(gfxDelay);
47  
      }
48  
      
49  
      if ((beatCount % jumpEvery) == 0) {
50  
        print("Now I should be moved!");
51  
        hyperMove(machine1, machine2);
52  
        System.exit(0);
53  
      }
54  
    }
55  
  }
56  
  
57  
  static synchronized S answer(S s, L<S> history) {
58  
    if (match3("get beat count", s))
59  
      return "" + beatCount;
60  
    if (match3("get delay", s))
61  
      return "" + delay;
62  
    if (match3("booted when", s))
63  
      return "" + booted;
64  
      
65  
    return null;
66  
  }
67  
}

Author comment

Began life as a copy of #1001367

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: #1001441
Snippet name: Jumping Heart (jumps between two machines) with window
Eternal ID of this version: #1001441/1
Text MD5: a3c91ebfb510c2633ae5c0eb8efd3935
Transpilation MD5: f931cb7383c9886a252ed129c746027b
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-16 18:18:29
Source code size: 1646 bytes / 67 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 568 / 646
Referenced in: [show references]