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)

1  
static Map<S, Number> ai_gc_distanceFunction_backwardValues = litcimap(
2  
  "is", 1,
3  
  [[is "a"]], 0.1,
4  
  [[unquotes to]], 0.1,
5  
  "probably is", 1,
6  
);
7  
8  
// returns NaN if not a relevant connection
9  
static double ai_gc_distanceFunction(S rel, bool forward) {
10  
  if (forward) ret 1; // all forward connections matter
11  
  
12  
  if (!forward) {
13  
    rel = dropSuffix(":", rel);
14  
    Number n = ai_gc_distanceFunction_backwardValues.get(rel);
15  
    if (n != null)
16  
      ret toDouble(n);
17  
  }
18  
    
19  
  ret nan();
20  
}

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: 453 / 492
Version history: 2 change(s)
Referenced in: [show references]