1 | sS ai_weightChangeBot_theory() { |
2 | ret [[ |
3 | import math |
4 | |
5 | theory validity { |
6 | // a human weighs between 80 and 400 pounds |
7 | $x is a human |
8 | & $x weighs ($y pounds) |
9 | => $y >= 80 & $y <= 400 |
10 | |
11 | contradiction => say (That can't be right) |
12 | } |
13 | |
14 | theory (weight change) { |
15 | $x weighs ($y pounds) |
16 | & last time $x weighed ($z pounds) |
17 | => proc { |
18 | if ($y < $z): |
19 | say (That is great!) |
20 | else if ($y > $z): |
21 | say (Aw, too bad, tomorrow is another day.) |
22 | else: |
23 | say (Tomorrow will be better) |
24 | } |
25 | } |
26 | |
27 | theory (remember last weight) { |
28 | $x weighs ($y pounds) |
29 | => proc { |
30 | unless contradiction: |
31 | delete all (last time $x weighed ($z pounds)) |
32 | store (last time $x weighed ($y pounds)) |
33 | } |
34 | } |
35 | |
36 | theory (interpret input) { |
37 | $x says (i weigh $y pounds) |
38 | => $x weighs ($y pounds) |
39 | |
40 | $x says (my weight is $y pounds) |
41 | => $x weighs ($y pounds) |
42 | } |
43 | ]]; |
44 | } |
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: | #1025766 |
Snippet name: | ai_weightChangeBot_theory |
Eternal ID of this version: | #1025766/2 |
Text MD5: | 5adf090764cf6375c2b3ee0b9bf0372f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2019-10-18 23:37:25 |
Source code size: | 1109 bytes / 44 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 221 / 263 |
Version history: | 1 change(s) |
Referenced in: | [show references] |