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

20
LINES

< > BotCompany Repo | #1011804 // ai_gc_distanceFunction

JavaX fragment (include)

static Map<S, Number> ai_gc_distanceFunction_backwardValues = litcimap(
  "is", 1,
  [[is "a"]], 0.1,
  [[unquotes to]], 0.1,
  "probably is", 1,
);

// returns NaN if not a relevant connection
static double ai_gc_distanceFunction(S rel, bool forward) {
  if (forward) ret 1; // all forward connections matter
  
  if (!forward) {
    rel = dropSuffix(":", rel);
    Number n = ai_gc_distanceFunction_backwardValues.get(rel);
    if (n != null)
      ret toDouble(n);
  }
    
  ret nan();
}

download  show line numbers  debug dex  old transpilations   

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

No comments. add comment

Snippet ID: #1011804
Snippet name: ai_gc_distanceFunction
Eternal ID of this version: #1011804/3
Text MD5: 0e88f122e46091461a39657176be8bab
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-11-05 07:51:18
Source code size: 510 bytes / 20 lines
Pitched / IR pitched: No / No
Views / Downloads: 452 / 491
Version history: 2 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)