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

11
LINES

< > BotCompany Repo | #1018351 // stepAllWithStats

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (2607L/16K).

1  
svoid stepAllWithStats(Steppable s, Long maxSteps default null) {
2  
  if (s == null) ret;
3  
  long n = 0;
4  
  long time = sysNow();
5  
  if (maxSteps == null)
6  
    while ping (s.step()) ++n;
7  
  else
8  
    while ping (n < maxSteps && s.step()) ++n;
9  
  time = sysNow()-time;
10  
  print(n2(n, "step") + " in " + n2(time) + " ms");
11  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv

No comments. add comment

Snippet ID: #1018351
Snippet name: stepAllWithStats
Eternal ID of this version: #1018351/7
Text MD5: 3fec8363e0025392d46a440547143c60
Transpilation MD5: e0e3591e6da42246fe8220ae6e34ec35
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-12-10 15:53:30
Source code size: 324 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 397 / 537
Version history: 6 change(s)
Referenced in: [show references]