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

19
LINES

< > BotCompany Repo | #1014081 // ai_mechList_placeholdersToRandomEntry

JavaX fragment (include)

1  
static S ai_mechList_placeholdersToRandomEntry(S s) {
2  
  ret (S) applyUntilEq(f ai_mechList_placeholdersToRandomEntry_1, s);
3  
}
4  
5  
static S ai_mechList_placeholdersToRandomEntry_1(S s) {
6  
  L<S> tok = javaTokWithAngleBrackets(s);
7  
  for (int i = 1; i < l(tok); i += 2) {
8  
    S t = tok.get(i);
9  
    if (isAngleBracketed(t)) {
10  
      t = deAngleBracket(t);
11  
      S list = or(ai_placeholderToList(t), t);
12  
      L<S> entries = mechList(list);
13  
      if (entries == null)
14  
        fail("No list for <" + t + ">");
15  
      tok.set(i, random(entries));
16  
    }
17  
  }
18  
  ret join(tok);
19  
}

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: #1014081
Snippet name: ai_mechList_placeholdersToRandomEntry
Eternal ID of this version: #1014081/6
Text MD5: aade55200f54cc70c121754684d06efd
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-03-28 22:35:59
Source code size: 584 bytes / 19 lines
Pitched / IR pitched: No / No
Views / Downloads: 426 / 464
Version history: 5 change(s)
Referenced in: [show references]