Uses 5909K of libraries. Click here for Pure Java version (9780L/51K).
1 | !7 |
2 | |
3 | set flag AllowMetaCode. set flag Reparse. meta-transformNow { tok_standardBot }
|
4 | |
5 | standard bot TheAIShould {
|
6 | allServers {
|
7 | static noeq record Entry(S text) extends HasGlobalID {}
|
8 | } |
9 | |
10 | Map<S, Entry> db = ciMap(); |
11 | |
12 | S add(S s) {
|
13 | if (!db.containsKey(s)) { db.put(s, new Entry(s)); change(); ret "OK, stored"; }
|
14 | ret "I know"; |
15 | } |
16 | S remove(S s) { ret db.remove(s) != null ? with(r change, "OK, then not") : "I know"; }
|
17 | S listWithPattern(S pat) { ret or2(lines(mapValuesToList(db, x -> discord_prependGlobalID(x) + format_ellipsis(pat, x.text))), "nothing"); }
|
18 | |
19 | sync S processSimplifiedLine(S s, O... _) {
|
20 | try answer super.processSimplifiedLine(s, _); |
21 | new Matches m; |
22 | |
23 | meta {
|
24 | S program = [[ |
25 | The AI should ... = + |
26 | The AI doesn't have to ... = - |
27 | What should the AI do = listWithPattern("The AI should ...")
|
28 | ]]; |
29 | ret ai_lineEquationsToMatchX2Statements(jreplace_multi(program, |
30 | "+", "add(\\$1);", |
31 | "-", "remove(\\$1);")); |
32 | } |
33 | null; |
34 | } |
35 | } |
Began life as a copy of #1025387
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1025493 |
| Snippet name: | The AI Should [LIVE] |
| Eternal ID of this version: | #1025493/19 |
| Text MD5: | 768becbb75cec43ae27d23178ba1d4ca |
| Transpilation MD5: | d7ae74e4457e5463209582c4353c021c |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX source code (Dynamic Module) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-10-01 14:51:16 |
| Source code size: | 1067 bytes / 35 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 620 / 6107 |
| Version history: | 18 change(s) |
| Referenced in: | [show references] |