Warning: session_start(): open(/var/lib/php/sessions/sess_dpupl8i700gp542vil1oj304ae, 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
sS yesText = [[
y
yes
yeah
y
yup
yo
correct
sure
ok
affirmative
ja
ok
richtig
gut
mach das
ja ich will
bitte
ist so
isso
jau
jawohl
stimmt
]];
sS noText = [[
no
n
nope
negative
don't do that
nay
nein
nö
negativ
lass das
]];
static Set yesLiterals, noLiterals;
static Bool algo_0_1(S s) {
if (yesLiterals.contains(s)) true;
if (noLiterals.contains(s)) false;
null;
}
static Bool algo_0_2(S s) {
s = trim(s);
try bool algo_0_1(s);
S s2 = collapseWord(s);
if (neq(s, s2))
try bool algo_0_1(s2);
null;
}
p {
autoRestart();
sahara();
consoleHeight(500);
logModuleOutput();
readLinePrefix("[] Eingabe: ");
yesLiterals = tlftj_asCISet(yesText);
noLiterals = tlftj_asCISet(noText);
bot();
centerBigConsole2();
focusConsole(random(tossCoin() ? yesLiterals : noLiterals);
controls2_default();
}
svoid controls_feedback(S text) {
disableConsoleInput();
showControls(withCenteredTitle("Ich glaube:",
vstackWithSpacing(setFontSize(15, jcenteredBoldLabel(text)),
centeredButtons(
"Das ist korrekt", r {
print("=> KORREKT");
hideControls();
uploadOutputSinceLastInput();
},
"Das ist nicht korrekt", r {
print("=> INKORREKT");
fS s = lastInput();
uploadOutputSinceLastInput();
showControls(vstackWithSpacing(
setFontSize(13, jcenteredBoldLabel("Was heißt " + quote(s) + " denn?")),
jcenteredbuttons(
"Ja", r { correct(s, true) },
"Nein", r { correct(s, false) },
"Was anderes", r { correct(s, null) })));
}))));
}
answer {
Bool b = algo_0_2(s);
S a = formatSatz(s, b);
controls_feedback(a);
try answer a;
}
sS formatSatz(S s, Bool b) {
ret quote(s) + " " + (
isTrue(b) ? "bedeutet 'Ja'"
: isFalse(b) ? "bedeutet 'Nein'"
: "bedeutet weder Ja noch Nein");
}
svoid controls2_default() {
showControls2(jcenteredlabel("Schreib doch mal was ja-iges oder nein-iges:"));
}
svoid correct(S input, Bool b) {
print(formatSatz(input, b));
uploadOutputSinceLastInput();
enableConsoleInput();
hideControls();
}