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

51
LINES

< > BotCompany Repo | #1018348 // Test Bot v5 [steppable, Dyn Module]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (24222L/182K).

!7

set flag DynModule.

sclass TestBot extends DynObjectTable<ExecutedRule> {
  InputChooser inputChooser = new(this);
  S source;
  S inputAs = "Input:"; // "Input:" or "Fact:"
  bool unsafeEvals;
  
  start {
    dm_useLocalMechListCopies();
    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))),
      super.visualize()));
  }
  
  void doIt { update(inputChooser.input()); }
  
  void update { if (inputChooser.update()) update(inputChooser.input()); }
  
  void update(S input) {
    temp enter();
    bool inputAsFact = cic(inputAs, 'fact);
    NLLogicChecker_v2.staticVerbose = true;
    temp tempSetTL(nlLogic_processInputOrFact_steppable_allowUnsafeEvals, unsafeEvals);
    final MultiMap<Int, ExecutedRule> mm = treeMultiMap();
    Steppable steppable = nlLogic_processInputOrFact_steppable(input, inputAsFact, 
      or2(trim(source), "<default>"), new Collector<ExecutedRule>() {
        bool add(ExecutedRule r) {
          mm.put(ai_executedRuleScorer().get(r), r);
          true;
        }
      });
    stepAllWithStats_multiThreaded(steppable);
      
    L<ExecutedRule> l = mm.allValues();
    printLength("l=", l);
    setData(l);
  }
}

Author comment

Began life as a copy of #1018323

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: #1018348
Snippet name: Test Bot v5 [steppable, Dyn Module]
Eternal ID of this version: #1018348/7
Text MD5: c15cc6def6e5448daf46b95fedc03be0
Transpilation MD5: f923d496ec5ed761160e16a533e5000b
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-09-20 05:53:15
Source code size: 1646 bytes / 51 lines
Pitched / IR pitched: No / No
Views / Downloads: 457 / 4977
Version history: 6 change(s)
Referenced in: [show references]