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

!7

concept Config { new L<S> bots; /* contains program IDs */ }
static new L<Pair<S, Class>> bots; // pair(program ID, main class)
p-subst { db(); loadBots(); botSleep(); }

svoid loadBots {
  cleanUpAndClear(bots); for (S bot : config().bots) bots.add(pair(bot, runSubBot(bot)));
}

answer {
  lock dbLock();
  if "add bot *" {
    setAddOrMoveToFront(config().bots, formatSnippetID($1));
    loadBots(); ret "OK";
  }
  if "remove bot *" {
    config().bots.remove(formatSnippetID($1));
    loadBots(); ret "OK";
  }
  if "list bots" ret sfu(config().bots);
  try answer scanMultipleBots(map(f second, bots), s);
}

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: 489 / 584
Referenced in: