1 | // e. g. |
2 | // if (Y -> is the opposite of -> X) |
3 | // and input (if something is not X, then it is...) |
4 | // then say (Y!) |
5 | |
6 | static S ai_ifAndInput_v2(S rule, S input) {
|
7 | print("ai_ifAndInput_v2");
|
8 | new Matches m; |
9 | if (!simpleStarMatchOnCTokensIC("if * and input * then say *",
|
10 | javaTokDroppingBracketsC_unquote(rule), m)) unsuitableRule(); |
11 | |
12 | S d2 = $2; |
13 | printStructs(+d2, +input); |
14 | S x = matchBigX(d2, input); |
15 | printStructs(+x); |
16 | if (x == null) null; |
17 | S pat = formatVars($1, litmap("X", x, "Y", "$X"));
|
18 | printStruct(+pat); |
19 | T3<S> t = ai_tripelize(pat); |
20 | printStruct(+t); |
21 | |
22 | S y = random(ai_texts(t)); |
23 | if (y == null) null; |
24 | ret ai_replaceBigY($3, y); |
25 | } |
Began life as a copy of #1013172
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: | #1013191 |
| Snippet name: | ai_ifAndInput_v2 - X + Y in first condition; allow variables in input; match input first |
| Eternal ID of this version: | #1013191/6 |
| Text MD5: | 9d34769134a9deaec1db1c0e6c18f36f |
| 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-27 07:07:57 |
| Source code size: | 691 bytes / 25 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 551 / 610 |
| Version history: | 5 change(s) |
| Referenced in: | [show references] |