Warning: session_start(): open(/var/lib/php/sessions/sess_90i5c1q5hqhkgu2qhrodvjunmv, 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
!752
!include #1004972 // Text AI Include
static Map initialLines() {
ret lithashmap(
ShowWindow.class, "Show the window!",
HideWindow.class, "Hide the window!",
IsShowing.class, "Is the window showing?",
Praise.class, "Nicely done, AI.",
Hello.class, "Hello AI!",
NotForMe.class, "[Statement not meant for me]",
Unclear.class, "[Unclear statement]");
}
// the application (show/hide window)
sconcept ShowWindow extends Interpretation {}
sconcept HideWindow extends Interpretation {}
sconcept IsShowing extends Interpretation {
new Ref answerModulator; // optional
}
sconcept TheFlag {
bool set;
}
static JFrame frame;
p-substance {
useDataDirOf("#1004930");
//loadAndAutoSaveConcepts();
mainConcepts = new Concepts {
RC xfindLine(S text) {
ret main.xfindLine(text);
}
};
mainConcepts.persist();
initialUnaryConcepts(initialLines());
mainConcepts.quietSave = true;
frame = getFrame(showImage("#1002235", "Eleu walks"));
onFrameClose(frame, r {
print("> Window closed by user.");
setFlag(false);
});
updateVisibility();
print("Lines: " + l(conceptsOfType("Line")));
makeBot("Boolean Flag Test.");
methodsBot("Boolean Flag DB.", listPlus(
exposedDBMethods, "xfindLine"));
initConsole();
print("AI ready to rock. Go \"Admin\" to see my commands.");
print("Or try \"show window\" and \"hide window\".");
kevin("Hello");
print();
}
static TheFlag getFlag() {
ret uniq(TheFlag.class);
}
static S answerInterpreted(S s, Interpretation ip) {
if (ip instanceof Praise) ret kevin("Thank you :)");
if (ip instanceof Hello) ret kevin("Hello! :)");
if (ip instanceof NotForMe) ret kevin("Talk to the hand");
if (ip instanceof Unclear) ret "[Unclear statement]";
TheFlag flag = getFlag();
if (ip instanceof IsShowing)
ret kevin(flag.set
? "Window is showing."
: "Window is not showing.");
if (ip instanceof ShowWindow) {
if (flag.set) ret "Window already showing!";
setFlag(true); updateVisibility();
kevin("showing");
ret "OK, showing window.";
}
if (ip instanceof HideWindow) {
if (!flag.set) ret "Window already hidden!";
setFlag(false); updateVisibility();
kevin("hiding");
ret "OK, hiding window.";
}
null;
}
svoid updateVisibility {
awt {
frame.setVisible(getFlag().set);
swingLater(200, r {
consoleFrame().toFront();
});
//focusConsole();
}
}
svoid admin {
runInNewThread("#1004926");
}
svoid setFlag(bool flag) {
cset(getFlag(), set := flag);
}