Warning: session_start(): open(/var/lib/php/sessions/sess_5c9i99121d0mu4th6ur9shspjj, 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
standardBot1 DiscordToPhilosophyBot {
new SimpleFactStore factStore;
transient S theory = [[
import math
theory validity {
// a human weighs between 80 and 400 pounds
$x is a human
& $x weighs ($y pounds)
=> $y >= 80 & $y <= 400
contradiction => say (That can't be right)
}
theory (weight change) {
$x weighs $y
& last time $x weighed ($z pounds)
=> proc {
if ($y < $z):
say (You lost weight)
else if ($y > $z):
say (You gained weight)
else:
say (You are stagnant)
}
}
theory (remember last weight) {
$x weighs ($y pounds)
=> proc {
delete all (last time $x weighed $z)
store (last time $x weighed $y)
}
}
theory (interpret input) {
$x says (i weigh $y pounds)
=> $x weighs ($y pounds)
$x says (my weight is $y pounds)
=> $x weighs ($y pounds)
}
]];
sync S processSimplifiedLine(S s, O... _) {
try answer super.processSimplifiedLine(s, _);
optPar long userID;
optPar bool fromBot;
print(userID + " (" + (fromBot ? "bot" : "human") + "): " + s);
S user = "(user " + userID + ")";
PhilosophyBot1 bot = new(theory);
factStore.verbose = true;
philosophyBot1_factStore(bot, factStore);
bot.debugContradictionChecks = true;
bot.standardImports();
bot.autoOpenTheories();
bot.addFact(user + " is a " + (fromBot ? "bot" : "human"));
bot.addFact(user + " says (" + s + ")");
bot.run();
ret first(bot.matchFacts("$x", "say $x"));
}
}