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

1  
!7
2  
3  
set flag DynModule.
4  
5  
sclass TestBot extends DynObjectTable<ExecutedRule> {
6  
  InputChooser inputChooser = new(this);
7  
  S source;
8  
  S inputAs = "Input:"; // "Input:" or "Fact:"
9  
  bool unsafeEvals;
10  
  
11  
  start {
12  
    dm_useLocalMechListCopies();
13  
    inputChooser.delay = 1000;
14  
    itemToMap = itemToMap_ExecutedRule();
15  
  }
16  
  
17  
  visualize {
18  
    ret withMargin(northAndCenter(vstackWithSpacing(
19  
      westAndCenter(dm_fieldComboBox('inputAs,
20  
        ll("Input:", "Fact:")),
21  
        wrap(inputChooser)),
22  
      withLabel("Rules mech list (empty for default rules&facts):",
23  
        onEnter(dm_fieldTextField('source), rThread doIt)),
24  
      jrightalignedline(main.onChange(dm_fieldCheckBox("Allow unsafe evals", 'unsafeEvals), rThread doIt))),
25  
      super.visualize()));
26  
  }
27  
  
28  
  void doIt { update(inputChooser.input()); }
29  
  
30  
  void update { if (inputChooser.update()) update(inputChooser.input()); }
31  
  
32  
  void update(S input) {
33  
    temp enter();
34  
    bool inputAsFact = cic(inputAs, 'fact);
35  
    NLLogicChecker_v2.staticVerbose = true;
36  
    temp tempSetTL(nlLogic_processInputOrFact_allowUnsafeEvals, unsafeEvals);
37  
    setData(printLength("l=", nlLogic_processInputOrFact(input, inputAsFact, 
38  
      or2(trim(source), "<default>"))));
39  
  }
40  
}

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: 415 / 650
Version history: 15 change(s)
Referenced in: [show references]