1 | static new ThreadLocal<Boolean> pivoMode; |
2 | |
3 | !include #1002953 // Point Bot |
4 | |
5 | static L<S> matches = litlist( |
6 | "Are you William?", |
7 | "Oh sure I am!", |
8 | "the my guy called a", |
9 | |
10 | "" |
11 | ); |
12 | |
13 | static void pivoLoad() { |
14 | loadPointBot(); |
15 | } |
16 | |
17 | static synchronized S answer(S s) { |
18 | new Matches m; |
19 | if (!attn()) ret null; |
20 | if (!eq(getUserName (), "stefanreich") && !pivoMode. get ()) ret null; |
21 | |
22 | try answer answerPointBot(s); |
23 | |
24 | for (int i = 0; i+2 < l(matches); i += 3) { |
25 | S pat = matches.get(i); |
26 | S words = matches.get(i+2); |
27 | if (matchQuestion_dropping(pat, words, s)) |
28 | ret matches.get(i+1); |
29 | } |
30 | |
31 | // addition |
32 | |
33 | L<S> tok = codeTokensOnly(javaTok(s)); |
34 | |
35 | if (l(tok) == 3 && eq(get(tok, 1), "+") |
36 | && isInteger(get(tok, 0)) && isInteger(get(tok, 2))) |
37 | ret str(bigint(get(tok, 0)).add(bigint(get(tok, 2)))); |
38 | |
39 | ret s; |
40 | } |
41 | |
42 | static boolean matchQuestion_dropping(S pat, S wordsToDrop, S s) { |
43 | ret match(pat, dropWords(s, wordsToDrop)); |
44 | } |
45 | |
46 | static void log(S bot, S text) { |
47 | logMap(logName, "time", now(), "bot", bot, "msg", text); |
48 | } |
Began life as a copy of #1002931
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: | #1002943 |
Snippet name: | Pivo Logic English (include) |
Eternal ID of this version: | #1002943/1 |
Text MD5: | 330738d0b9744ee69ea1766a858cf034 |
Author: | stefan |
Category: | eleu / nl |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-04-10 18:32:04 |
Source code size: | 1099 bytes / 48 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 854 / 937 |
Referenced in: | [show references] |