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

25
LINES

< > BotCompany Repo | #1009335 // Simple MultiBot, first version [backup]

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

Uses 3874K of libraries. Click here for Pure Java version (8019L/54K/184K).

1  
!7
2  
3  
concept Config { new L<S> bots; /* contains program IDs */ }
4  
static new L<Pair<S, Class>> bots; // pair(program ID, main class)
5  
p-subst { db(); loadBots(); botSleep(); }
6  
7  
svoid loadBots {
8  
  cleanUpAndClear(bots); for (S bot : config().bots) bots.add(pair(bot, runSubBot(bot)));
9  
}
10  
11  
answer {
12  
  lock dbLock();
13  
  if "add bot *" {
14  
    setAddOrMoveToFront(config().bots, formatSnippetID($1));
15  
    loadBots(); ret "OK";
16  
  }
17  
  if "remove bot *" {
18  
    config().bots.remove(formatSnippetID($1));
19  
    loadBots(); ret "OK";
20  
  }
21  
  if "list bots" ret sfu(config().bots);
22  
  try answer scanMultipleBots(map(f second, bots), s);
23  
}
24  
25  
static Config config() { ret uniq_sync(Config); }

Author comment

Began life as a copy of #1009323

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

Snippet ID: #1009335
Snippet name: Simple MultiBot, first version [backup]
Eternal ID of this version: #1009335/1
Text MD5: 50a78dd875835da950df2ee7fed17c5d
Transpilation MD5: af1d6b96ed93c84b1762ab60fcdf11b7
Author: stefan
Category: javax / talking robots
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-23 21:49:53
Source code size: 692 bytes / 25 lines
Pitched / IR pitched: No / No
Views / Downloads: 488 / 582
Referenced in: [show references]