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

23
LINES

< > BotCompany Repo | #1002039 // Which bot is the biggest? (buggy-ish)

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

Libraryless. Click here for Pure Java version (895L/7K/20K).

!752

static Class mainBot;

answer {
  if (match("which bot is the biggest", s)) {
    Map<S, Class> botsByID = cast get(mainBot, "botsByID");
    new Map<S, Long> map;
    for (S id : keys(botsByID)) {
      Class bot = botsByID.get(id);
      new IdentityHashMap seen;
      
      seen.put(mainBot, true);
      seen.put(getJavaX(), true);
      // any more to put here?
      
      long size = dataSize(bot, seen);
      map.put(id, size);
    }
    S winner = keyWithBiggestValue(map);
    ret format3("The fattest bot is: * with an in-memory size of * bytes", winner, map.get(winner));
  }
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1002039
Snippet name: Which bot is the biggest? (buggy-ish)
Eternal ID of this version: #1002039/1
Text MD5: 833baae5f521e1909c02b101917cd5fb
Transpilation MD5: 69b1a74f65b12685f6256ca3df8e2228
Author: stefan
Category:
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-02-02 16:39:58
Source code size: 621 bytes / 23 lines
Pitched / IR pitched: No / No
Views / Downloads: 636 / 1337
Referenced in: [show references]