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: 632 / 730
Referenced in: #3000057 - Data zip of #1001441 on teubizvjbppd at 1445011287180
#3000058 - Data zip of #1001441 on teubizvjbppd at 1445011456620
#3000059 - Data zip of #1001441 on dhtvkmknsjym at 1442182443269
#3000060 - Data zip of #1001441 on teubizvjbppd at 1445011678836
#3000061 - Data zip of #1001441 on dhtvkmknsjym at 1442182654663
#3000062 - Data zip of #1001441 on teubizvjbppd at 1445011804552
#3000063 - Data zip of #1001441 on dhtvkmknsjym at 1442182828823
#3000064 - Data zip of #1001441 on teubizvjbppd at 1445011912859
#3000065 - Data zip of #1001441 on dhtvkmknsjym at 1442182883462
#3000066 - Data zip of #1001441 on teubizvjbppd at 1445011970827
#3000067 - Data zip of #1001441 on dhtvkmknsjym at 1442182964528
#3000068 - Data zip of #1001441 on teubizvjbppd at 1445012055225
#3000069 - Data zip of #1001441 on dhtvkmknsjym at 1442183020058
#3000070 - Data zip of #1001441 on teubizvjbppd at 1445012357911
#3000071 - Data zip of #1001441 on dhtvkmknsjym at 1442183326749
#3000073 - Data zip of #1001441 on teubizvjbppd at 1445026029966
#3000190 - Answer for stefanreich(>> t 20 questions)
#3000382 - Answer for ferdie (>> t = 1, f = 0)
#3000383 - Answer for funkoverflow (>> t=1, f=0 okay)