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

34
LINES

< > BotCompany Repo | #1001324 // Heart (silent because console is a little stupid - but definitely active)

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

Libraryless. Click here for Pure Java version (1322L/9K/31K).

!747

m {
  static volatile long beatCount;
  static volatile int delay = 1000;
  static long booted;
  static volatile boolean loud;
  
  p {
    booted = now();
    readLocally("beatCount");
    makeAndroid3("Heart.");
    print("Beating at 1/" + delay + " ms...");
    
    while (true) {
      if (loud)
        print("beep!");
      ++beatCount;
      saveLocally("beatCount");
      sleep(delay);
    }
  }
  
  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;
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001324
Snippet name: Heart (silent because console is a little stupid - but definitely active)
Eternal ID of this version: #1001324/1
Text MD5: 4b8b8e35e95e580619e3a7312c218668
Transpilation MD5: af1ecb977535fc59f25267929edf4070
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-10-09 21:10:47
Source code size: 713 bytes / 34 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 514 / 564
Referenced in: [show references]