Download Jar. Libraryless. Click here for Pure Java version (5817L/40K).
!7 sS regexpActivator = "."; // always !include once #1017764 // VirtualMechLists sS mechLibID = #1400124; static O onOutput; // VF1<S> static bool authorized; sS msgGlobalID; static L<AbstractThinkBot> bots; abstract sclass AbstractThinkBot { transient VF1<? super S> postMessage; transient new L<Map> recentHistory; abstract void thinkAbout(S input); void postMessage(S s) { callF(postMessage, s); } JComponent visualize() { ret jpanel(); } } p { mech_useLibrary(mechLibID); L<Class<? extends AbstractThinkBot>> classes = botClasses(); print("Have think classes: " + classNames(classes)); makeBots(); bot(); } static L<Class<? extends AbstractThinkBot>> botClasses() { ret myNonAbstractClassesImplementing(AbstractThinkBot); } svoid makeBots() { bots = map nuWithoutArguments(botClasses()); } sbool telegram_amIAuthorized() { ret authorized; } svoid setMsgGlobalID(S globalID) { msgGlobalID = globalID; } sS answer(S s) { temp tempSetThreadLocal(telegram_msg_tl(), litorderedmap(globalID := msgGlobalID)); msgGlobalID = null; final new L<S> output; for (AbstractThinkBot bot : bots) pcall { bot.postMessage = voidfunc(S s) { print(">> " + s); pcallF(onOutput, s); output.add(s); }; bot.thinkAbout(s); } ret rtrim(lines(output)); } svoid setDebug(bool b) { for (O bot : unnull(bots)) setOpt(bot, debug := b); }
download show line numbers debug dex old transpilations
Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1017703 |
Snippet name: | Baked Bot Main Program (assembled into #1017706) |
Eternal ID of this version: | #1017703/30 |
Text MD5: | f710d5889df7044abe2f1728f139a87e |
Transpilation MD5: | 3e3c7d67e1ebd370ebf953d7b2d93744 |
Author: | stefan |
Category: | javax |
Type: | JavaX source code (desktop) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-08-18 15:50:55 |
Source code size: | 1488 bytes / 71 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 679 / 1663 |
Version history: | 29 change(s) |
Referenced in: | [show references] |