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

!747
!image classes

m {
  static volatile long beatCount;
  static volatile int delay = 1000;
  static long booted;
  //static volatile boolean loud = true;
  static int jumpEvery = 10;
  static boolean loud = false;
  
  // We alternate between two machines as a test.
  static S machine1 = "teubizvjbppd";
  static S machine2 = "dhtvkmknsjym";
  
  static ShowBigText sbt;
  static int delay = 1000;
  static int gfxDelay = 100;
  
  !include #1001425 // ShowBigText
  
  p {
    booted = now();
    readLocally("beatCount");
    makeAndroid3("Heart.");
    print("Beat count " + beatCount + ". Beating at 1/" + delay + " ms...");
    
    sbt = new ShowBigText;
    sbt.title = "Jumping Heart";
    sbt.showText("" + beatCount);
    
    awt {
      moveDown(getFrame(sbt.is), 100);
    }
    
    while (true) {
      if (loud)
        print("beep!");
      ++beatCount;
      saveLocally("beatCount");
      
      for (float i = 1.0f; i >= 0; i -= gfxDelay/(float) delay) {
        sbt.foreground = Color.white;
        sbt.background = new Color(0f, i*0.8f, 0f);
        sbt.showText("" + beatCount);
        sleep(gfxDelay);
      }
      
      if ((beatCount % jumpEvery) == 0) {
        print("Now I should be moved!");
        hyperMove(machine1, machine2);
        System.exit(0);
      }
    }
  }
  
  static synchronized S answer(S s, L<S> history) {
    if (match3("get beat count", s))
      return "" + beatCount;
    if (match3("get delay", s))
      return "" + delay;
    if (match3("booted when", s))
      return "" + booted;
      
    return null;
  }
}

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: 565 / 643
Referenced in: [show references]