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

43
LINES

< > BotCompany Repo | #1023195 // MultiSpaceReasoning1

JavaX fragment (include) [tags: use-pretranspiled]

Transpiled version (10386L) is out of date.

sclass MultiSpaceReasoning1 {
  // spaces & names
  
  sS objectiveSpace = 'objective, computerSpace = 'computer, userSpace = 'user;
  S userName = "usery", computerName = "computery";
  
  int stepLimit = 1000;
  
  new MultiMap<S, IAttractor> rulesForSpace;
  bool debug;
  
  Set<ES> rewriteInSpace(S space, Collection<ES> inputs) {
    ret applyAttractors_es(rulesForSpace.get(space), inputs, max := stepLimit);
  }
  
  Collection<ES> reason_inputToAnswer(S input) {
    ret reason_inputToAnswer(ll(ext(input)));
  }
  
  Collection<ES> reason_inputToAnswer(Collection<ES> inputs) {
    // first, rewrite in user space
    Set<ES> outputs = rewriteInSpace(userSpace, inputs);
    if (debug) pnlIndent("User space > ", outputs);
    
    // translate to objective space
    Collection<ES> outputs2 = ai_spaceToSpace_es(userSpace, objectiveSpace, outputs, +computerName, +userName);
    if (debug) pnlIndent("Translated to objective space > ", outputs2);
 
    // rewrite in objective space
    Collection<ES> outputs3 = rewriteInSpace(objectiveSpace, outputs2);
    if (debug) pnlIndent("Objective space > ", outputs3);
    
    // translate to computer space
    Collection<ES> outputs4 = ai_spaceToSpace_es(objectiveSpace, computerSpace, outputs3, +computerName, +userName);
    if (debug) pnlIndent("Bot space > ", outputs4);
    
    ret outputs4;
  }
  
  <A extends IAttractor> void addRules(MultiMap<S, A> mm) {
    rulesForSpace.putAll((MultiMap) mm);
  }
}

Author comment

Began life as a copy of #1023180

download  show line numbers  debug dex  old transpilations   

Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1023195
Snippet name: MultiSpaceReasoning1
Eternal ID of this version: #1023195/18
Text MD5: 2ea3a26a0e4698ccc25a1aed126d6f87
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2019-05-19 12:37:31
Source code size: 1511 bytes / 43 lines
Pitched / IR pitched: No / No
Views / Downloads: 390 / 914
Version history: 17 change(s)
Referenced in: #1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)