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

1  
!752
2  
3  
static Class mainBot;
4  
5  
answer {
6  
  if (match("which bot is the biggest", s)) {
7  
    Map<S, Class> botsByID = cast get(mainBot, "botsByID");
8  
    new Map<S, Long> map;
9  
    for (S id : keys(botsByID)) {
10  
      Class bot = botsByID.get(id);
11  
      new IdentityHashMap seen;
12  
      
13  
      seen.put(mainBot, true);
14  
      seen.put(getJavaX(), true);
15  
      // any more to put here?
16  
      
17  
      long size = dataSize(bot, seen);
18  
      map.put(id, size);
19  
    }
20  
    S winner = keyWithBiggestValue(map);
21  
    ret format3("The fattest bot is: * with an in-memory size of * bytes", winner, map.get(winner));
22  
  }
23  
}

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: 639 / 1341
Referenced in: [show references]