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

svoid stepAllWithStats(Steppable s, Long maxSteps default null) {
  if (s == null) ret;
  long n = 0;
  long time = sysNow();
  if (maxSteps == null)
    while ping (s.step()) ++n;
  else
    while ping (n < maxSteps && s.step()) ++n;
  time = sysNow()-time;
  print(n2(n, "step") + " in " + n2(time) + " ms");
}

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: 396 / 536
Version history: 6 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)
#1018354 - stepAllWithStats_multiThreaded
#1024992 - stepAll
#1032062 - stepMaxWithStats