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

34
LINES

< > BotCompany Repo | #1001325 // Heart (loud)

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

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

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  
  
9  
  p {
10  
    booted = now();
11  
    readLocally("beatCount");
12  
    makeAndroid3("Heart.");
13  
    print("Beat count " + beatCount + ". Beating at 1/" + delay + " ms...");
14  
    
15  
    while (true) {
16  
      if (loud)
17  
        print("beep!");
18  
      ++beatCount;
19  
      saveLocally("beatCount");
20  
      sleep(delay);
21  
    }
22  
  }
23  
  
24  
  static synchronized S answer(S s, L<S> history) {
25  
    if (match3("get beat count", s))
26  
      return "" + beatCount;
27  
    if (match3("get delay", s))
28  
      return "" + delay;
29  
    if (match3("booted when", s))
30  
      return "" + booted;
31  
      
32  
    return null;
33  
  }
34  
}

Author comment

Began life as a copy of #1001324

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1001325
Snippet name: Heart (loud)
Eternal ID of this version: #1001325/1
Text MD5: d8ec4390a0cbf937d37387e8665ab04f
Transpilation MD5: 880df359f56a63c61f589682eaa73093
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:49
Source code size: 750 bytes / 34 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 670 / 1323
Referenced in: [show references]