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

30
LINES

< > BotCompany Repo | #1001845 // Combine logic engines (works)

JavaX source code [tags: use-pretranspiled] - run with: x30.jar

Libraryless. Click here for Pure Java version (540L/4K/14K).

!752

m {
  // it's one engine for two-word sentences, one for three-word
  // sentences - but it could be anything, really.
  // the point is to show how simply they can be combined.
  
  static L<S> engineIDs = litlist("#1001841", "#1001844");
  
  static new L<Class> engines;
  
  p {
    for (S engineID : engineIDs)
      engines.add(hotwire(engineID));
    print(l(engines) + " engine(s) loaded.");
    askMyself("assert honk isA bonk");
    assertEquals("1", askMyself("query honk isA bonk"));
    assertEquals("0", askMyself("query bonk isA honk"));
    print("OK!");
  }
  
  static S answer(S s) {
    for (Class engine : engines)
      pcall {
        S result = callStaticAnswerMethod(engine, s);
        if (result != null) ret result;
      }
    ret null;
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 15 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1001845
Snippet name: Combine logic engines (works)
Eternal ID of this version: #1001845/1
Text MD5: 2cd565f12f7556214ad05721b9429d08
Transpilation MD5: d0c6417f5e04d72cac3aaa99a9cc6261
Author: stefan
Category: javax
Type: JavaX source code
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2015-12-03 16:49:55
Source code size: 806 bytes / 30 lines
Pitched / IR pitched: No / Yes
Views / Downloads: 823 / 1253
Referenced in: [show references]