Warning: session_start(): open(/var/lib/php/sessions/sess_kft4uljluogil5gcvvhbdep78p, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
!7
set flag AllowMetaCode.
standardBot1 TheAICan_v2 {
allServers {
static noeq record Procedure(S text) extends HasGlobalID {
}
static noeq record Entry(S text) extends HasGlobalID {
new L how;
}
}
Map db = ciMap();
S add(S s) {
if (!db.containsKey(s)) { db.put(s, new Entry(s)); change(); ret "OK, stored"; }
ret "I know";
}
S remove(S s) { ret db.remove(s) != null ? with(r change, "OK, then not") : "I know"; }
S listWithPattern(S pat) {
ret or2(lines(mapValuesToList(db, x -> discord_prependGlobalID(x) + format_ellipsis(pat, x.text)
+ appendBracketed(nMethods(x.how, method))
)), "nothing");
}
sync S processSimplifiedLine(S s, O... _) {
try answer super.processSimplifiedLine(s, _);
new Matches m;
meta {
S program = [[
The AI can ... = +
The AI can't actually ... = -
What can the AI do = listWithPattern("The AI can ...")
]];
ret ai_lineEquationsToMatchX2Statements(jreplace_multi(program,
"+", "add(\\$1);",
"-", "remove(\\$1);"));
}
null;
}
}