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

11
LINES

< > BotCompany Repo | #1013445 // ai_ruleToJava

JavaX fragment (include)

1  
static S ai_ruleToJava(S ruleName) {
2  
  S ruleText = unquote(firstPossibleRule(ai_texts("$X", "is", ruleName)));
3  
  if (ruleText == null) fail("Rule not found: " + ruleName);
4  
  S op = joinWithSpace(ai_getOperator(ruleText));
5  
  if (neq(op, "if input * then say *")) fail("Unknown rule op: " + op);
6  
  L<S> l = ai_getOperands(ruleText);
7  
  ret "static S rule_" + wordsToCamelCase(lower(ruleName)) + "() {\n" +
8  
    "  ai_checkInput_match3(" + quote(deRoundBracket(first(l))) + ");\n" +
9  
    "  ret " + quote(deRoundBracket(second(l))) + ";\n" +
10  
    "}";
11  
}

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: #1013445
Snippet name: ai_ruleToJava
Eternal ID of this version: #1013445/5
Text MD5: 5e9a00592a960eb510a3772a0b3c77fd
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-01-07 02:31:42
Source code size: 557 bytes / 11 lines
Pitched / IR pitched: No / No
Views / Downloads: 474 / 510
Version history: 4 change(s)
Referenced in: [show references]