Libraryless. Click here for Pure Java version (1549L/10K/35K).
!752 // Our version of the #1002317's Bot class, just for querying. // Thanks to the magic of restructure(), it will be filled // automagically. static class Bot { S id; // always formatted boolean enabled, always; } answer { if (swic(s, "timing ")) { S input = dropPrefix("timing ", s); O dispatcher = call(getMainBot(), "getDispatcher"); L bots = cast call(dispatcher, "getSubBots"); new L<S> l; long startTime = now(); for (int i = 0; i < l(bots); i++) { Bot bot = null; time {} try { bot = (Bot) restructure(bots.get(i)); if (!bot.enabled) { l.add(bot.id + ": Not enabled"); continue; } if (sameSnippetID(bot.id, getProgramID())) continue; // skip myself Class c = cast call(dispatcher, "getClassOfSubBot", bot.id); if (c != null) { S a = null; time { a = callStaticAnswerMethod(c, input); } if (empty(a)) l.add(bot.id + ": " + lastTiming() + " ms - \"\""); else { l.add(bot.id + ": " + lastTiming() + " ms - RETURN " + quote(a)); informAlwaysBots(dispatcher, subList(bots, i+1), input, l); break; } } } catch(Exception e) { l.add(exceptionToUser(e)); } } l.add("Total: " + (now()-startTime) + " ms"); ret "```" + fromLines(l) + "```"; } } static void informAlwaysBots(O dispatcher, L<Bot> bots, S s, L<S> l) { for (O _bot : bots) { Bot bot = (Bot) restructure(_bot); if (bot.always) pcall { // TODO: print exception Class c = cast call(dispatcher, "getClassOfSubBot", bot.id); if (c != null) { S a = null; time { a = callStaticAnswerMethod(c, s); } l.add(bot.id + " (always): " + lastTiming() + " ms - " + quote(a)); } } } }
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment