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

40
LINES

< > BotCompany Repo | #1018272 // Test Bot v3 [Dyn Module]

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

Libraryless. Click here for Pure Java version (23990L/181K).

!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 list (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_allowUnsafeEvals, unsafeEvals);
    setData(printLength("l=", nlLogic_processInputOrFact(input, inputAsFact, 
      or2(trim(source), "<default>"))));
  }
}

Author comment

Began life as a copy of #1018254

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: #1018272
Snippet name: Test Bot v3 [Dyn Module]
Eternal ID of this version: #1018272/16
Text MD5: 4410d18e4ee663d6d1a7abc3354e7325
Transpilation MD5: 3c8662193e38e9b7b17ef12649acfd42
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-19 14:50:12
Source code size: 1270 bytes / 40 lines
Pitched / IR pitched: No / No
Views / Downloads: 416 / 651
Version history: 15 change(s)
Referenced in: #1018302 - Logic Tester [with direct input of rules & facts, Dyn Module]
#1018323 - Test Bot v4 [with failed rules, Dyn Module]