Libraryless. Click here for Pure Java version (24310L/183K).
!7 set flag DynModule. sclass TestBot extends DynObjectTable<ExecutedRule> { InputChooser inputChooser = new(this); S source; S inputAs = "Input:"; // "Input:" or "Fact:" bool unsafeEvals, showFailed; int maxEntries = 100; start { dm_useLocalMechListCopies(); set transpileRaw_useDiskCache; inputChooser.delay = 1000; itemToMap = itemToMap_ExecutedRule(); } visualize { ret withMargin(northAndCenter(vstackWithSpacing( westAndCenter(dm_fieldComboBox('inputAs, ll("Input:", "Fact:")), wrap(inputChooser)), withLabel("Rules mech lists (empty for default rules&facts):", onEnter(dm_fieldTextField('source), rThread doIt)), jrightalignedline( main.onChange(dm_fieldCheckBox("Allow unsafe evals", 'unsafeEvals), rThread doIt), main.onChange(dm_fieldCheckBox("Show failed rules", 'showFailed), rThread doIt), jlabel("Show"), jminwidth(50, jLiveValueIntTextField(dm_fieldLiveValueWithNotify('maxEntries, r doIt))), jlabel("entries") )), super.visualize())); } void doIt { updateMe(); } void update { if (inputChooser.update()) update(inputChooser.input()); } void update(S input) enter { final bool inputAsFact = cic(inputAs, 'fact); print("Processing " + (inputAsFact ? "fact" : "input") + " " + input); NLLogicChecker_v2.staticVerbose = true; NLLogic_MultiThreadedEngine engine = new(ai_rulesAndFactsFromMechLists(or2(trim(source), "<default>"))); engine.unsafeEvals = unsafeEvals; engine.showFailed = showFailed; engine.seedInput(input); engine.fullRun(); L<ExecutedRule> all = engine.executedRules(); L<ExecutedRule> l = takeFirst(maxEntries, all); print("Showing " + l(l) + " out of " + l(all)); setData(l); } }
Began life as a copy of #1018348
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1018355 |
Snippet name: | Test Bot v6 [rewriting input, Dyn Module] |
Eternal ID of this version: | #1018355/19 |
Text MD5: | 023111b66da504c163a67c7ad08dd4ee |
Transpilation MD5: | cf1709dd7f89503b7f121f2ab17528e2 |
Author: | stefan |
Category: | javax / a.i. |
Type: | JavaX source code (Dynamic Module) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2018-12-24 00:58:31 |
Source code size: | 1876 bytes / 57 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 476 / 5436 |
Version history: | 18 change(s) |
Referenced in: | -