Uses 5909K of libraries. Click here for Pure Java version (17181L/95K).
1 | !7 |
2 | |
3 | standardBot1 DiscordToPhilosophyBot {
|
4 | new SimpleFactStore factStore; |
5 | |
6 | transient S theory = [[ |
7 | import math |
8 | |
9 | theory validity {
|
10 | // a human weighs between 80 and 400 pounds |
11 | $x is a human |
12 | & $x weighs ($y pounds) |
13 | => $y >= 80 & $y <= 400 |
14 | |
15 | contradiction => say (That can't be right) |
16 | } |
17 | |
18 | theory (weight change) {
|
19 | $x weighs ($y pounds) |
20 | & last time $x weighed ($z pounds) |
21 | => proc {
|
22 | if ($y < $z): |
23 | say (You lost weight) |
24 | else if ($y > $z): |
25 | say (You gained weight) |
26 | else: |
27 | say (You are stagnant) |
28 | } |
29 | } |
30 | |
31 | theory (remember last weight) {
|
32 | $x weighs ($y pounds) |
33 | => proc {
|
34 | unless contradiction: |
35 | delete all (last time $x weighed ($z pounds)) |
36 | store (last time $x weighed ($y pounds)) |
37 | } |
38 | } |
39 | |
40 | theory (interpret input) {
|
41 | $x says (i weigh $y pounds) |
42 | => $x weighs ($y pounds) |
43 | |
44 | $x says (my weight is $y pounds) |
45 | => $x weighs ($y pounds) |
46 | } |
47 | ]]; |
48 | |
49 | sync S processSimplifiedLine(S s, O... _) {
|
50 | try answer super.processSimplifiedLine(s, _); |
51 | |
52 | try answer factStore_cmds(factStore, s, authed(_)); |
53 | ret philosophyBotWithFactStore_discordAnswer(theory, factStore, s, _); |
54 | } |
55 | } |
Began life as a copy of #1025304
download show line numbers debug dex old transpilations
Travelled to 6 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1025733 |
| Snippet name: | Weight Change Bot [original demo, OK] |
| Eternal ID of this version: | #1025733/28 |
| Text MD5: | 9e7b453ea85689ff08071f12b3e5d051 |
| Transpilation MD5: | 8fa77040c91f456577893b46c627fd0f |
| Author: | stefan |
| Category: | javax |
| Type: | JavaX source code (Dynamic Module) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-10-18 22:11:52 |
| Source code size: | 1395 bytes / 55 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 571 / 1329 |
| Version history: | 27 change(s) |
| Referenced in: | [show references] |