Download Jar. Uses 3874K of libraries. Click here for Pure Java version (21822L/156K).
1 | !7 |
2 | |
3 | sS yesName = "eine Beleidung"; |
4 | sS noName = "keine Beleidigung"; |
5 | sbool useMiddle = false; |
6 | |
7 | sS yesText = [[ |
8 | Scheiß |
9 | ]]; |
10 | |
11 | sS noText = [[ |
12 | Prima |
13 | ]]; |
14 | |
15 | static Set<S> yesLiterals = ciSet(), noLiterals = ciSet(); |
16 | |
17 | static Bool algo_0_1(S s) {
|
18 | if (yesLiterals.contains(s)) true; |
19 | if (noLiterals.contains(s)) false; |
20 | null; |
21 | } |
22 | |
23 | static Bool algo_0_2(S s) {
|
24 | s = trim(s); |
25 | try bool algo_0_1(s); |
26 | S s2 = collapseWord(s); |
27 | if (neq(s, s2)) |
28 | try bool algo_0_1(s2); |
29 | null; |
30 | } |
31 | |
32 | static Bool algo_0_3(S s) {
|
33 | try bool algo_0_2(s); |
34 | S s2 = firstWord(s); |
35 | if (neq(s, s2)) |
36 | try bool algo_0_2(s); |
37 | null; |
38 | } |
39 | |
40 | p {
|
41 | autoRestart(); |
42 | independentSmartBot(); |
43 | onNewTriple(f onTriple); |
44 | sahara(); |
45 | consoleHeight(500); |
46 | showMessagesInGerman(true); |
47 | logModuleOutput(); |
48 | readLinePrefix("[] Eingabe: ");
|
49 | addAll_withCollapsed(yesLiterals, tlftj(yesText)); |
50 | addAll_withCollapsed(noLiterals, tlftj(noText)); |
51 | for (T3<S> t : triplesWithB("heißt")) onTriple(t);
|
52 | bot(); |
53 | centerBigConsole2(); |
54 | focusConsole(random(tossCoin() ? yesLiterals : noLiterals); |
55 | controls2_default(); |
56 | } |
57 | |
58 | svoid controls_feedback(S text) {
|
59 | disableConsoleInput(); |
60 | hideControls2(); |
61 | showControls(withCenteredTitle("Ich glaube:",
|
62 | vstackWithSpacing(setFontSize(15, jcenteredBoldLabel(text)), |
63 | centeredButtons( |
64 | "Das ist korrekt", r {
|
65 | print("=> KORREKT");
|
66 | uploadOutputSinceLastInput(); |
67 | reset(); |
68 | }, |
69 | "Das ist nicht korrekt", r {
|
70 | print("=> INKORREKT");
|
71 | fS s = lastInput(); |
72 | //uploadOutputSinceLastInput(); |
73 | |
74 | showControls(vstackWithSpacing( |
75 | setFontSize(13, jcenteredBoldLabel("Was heißt " + quote(s) + " denn?")),
|
76 | jcenteredbuttons( |
77 | "Es heißt " + yesName, r { correct(s, true) },
|
78 | "Es heißt " + noName, r { correct(s, false) },
|
79 | useMiddle ? "Es heißt was anderes" : null, r { correct(s, null) })));
|
80 | })))); |
81 | } |
82 | |
83 | answer {
|
84 | Bool b = algo_0_3(s); |
85 | S a = formatSatz(s, b); |
86 | controls_feedback(a); |
87 | try answer a; |
88 | } |
89 | |
90 | sS formatSatz(S s, Bool b) {
|
91 | ret quote(s) + " " + ( |
92 | isTrue(b) ? "bedeutet '" + yesName + "'" |
93 | : isFalse(b) ? "bedeutet '" + noName + "'" |
94 | : "bedeutet weder " + yesName + " noch " + noName); |
95 | } |
96 | |
97 | svoid controls2_default() {
|
98 | showControls2(jcenteredlabel("Schreib doch mal was " + yesName + "-iges oder " + noName + "-iges:"));
|
99 | } |
100 | |
101 | svoid correct(S input, Bool b) {
|
102 | print(formatSatz(input, b)); |
103 | post(quote(input), "heißt", boolSwitch(b, yesName, noName, "weder " + yesName + " noch " + noName)); |
104 | uploadOutputSinceLastInput(); |
105 | reset(); |
106 | } |
107 | |
108 | svoid reset {
|
109 | hideControls(); |
110 | enableConsoleInput(); |
111 | focusConsole(); |
112 | } |
113 | |
114 | svoid onTriple(T3<S> t) {
|
115 | if (eqic(t.b, "heißt") && isQuoted(t.a)) {
|
116 | if (eqic(t.c, yesName)) add_withCollapsed(yesLiterals, unquote(t.a)); |
117 | else if (eqic(t.c, noName)) add_withCollapsed(noLiterals, unquote(t.a)); |
118 | } |
119 | } |
Began life as a copy of #1013876
download show line numbers debug dex old transpilations
Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1013882 |
| Snippet name: | Beleidung oder nicht Bot |
| Eternal ID of this version: | #1013882/1 |
| Text MD5: | dcabfff074bc3f49d1c27e6124a4abaf |
| Transpilation MD5: | 85bf03b145593190f621cdd31dd60714 |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code (desktop) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2018-03-10 18:49:31 |
| Source code size: | 2969 bytes / 119 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 796 / 2218 |
| Referenced in: | [show references] |