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)

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

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: 403 / 428
Version history: 6 change(s)
Referenced in: [show references]