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

14
LINES

< > BotCompany Repo | #1012429 // ai_spec_daysOld

JavaX fragment (include)

1  
static void ai_spec_daysOld() {
2  
  for (S pat : ai_texts_unquote(".", "Look for answer pattern", "$X")) {
3  
    SS match = matchDollarVarsIC("$X is $Y days old", pat);
4  
    continue unless match != null;
5  
    S who = match.get("$X");
6  
    for (S dayBorn : filterMatchDollarX_IC("born on day $X", ai_texts(who, "was", "$Y"))) {
7  
      S today = matchDollarX_IC("day $X", ai_text("it", "today is", "$X"));
8  
      if (isInteger(today) && isInteger(dayBorn)) {
9  
        long age = parseLong(today)-parseLong(dayBorn);
10  
        post("Answer", "is", who + " is " + age + " days old");
11  
      }
12  
    }
13  
  }
14  
}

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: #1012429
Snippet name: ai_spec_daysOld
Eternal ID of this version: #1012429/7
Text MD5: e2f41fe6f01eed5c6e0e275a67bce125
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-12-02 19:37:00
Source code size: 601 bytes / 14 lines
Pitched / IR pitched: No / No
Views / Downloads: 405 / 431
Version history: 6 change(s)
Referenced in: [show references]