1 | sclass AI_ClocktimeBot > AttractorBot {
|
2 | Long now; |
3 | |
4 | public void run {
|
5 | say("I can resolve clock times for you");
|
6 | } |
7 | |
8 | // CONFIG |
9 | |
10 | class Attractor1 > Attractor {
|
11 | int hour, minute; |
12 | |
13 | public bool matches(S s) {
|
14 | new Matches m; |
15 | if (find3("* am", s, m) && isInteger($1)) {
|
16 | minute = 0; |
17 | hour = parseInt($1); |
18 | ret hour > 0; |
19 | } |
20 | |
21 | if (find3("* pm", s, m) && isInteger($1)) {
|
22 | minute = 0; |
23 | hour = parseInt($1)+12; |
24 | ret hour > 0; |
25 | } |
26 | |
27 | false; |
28 | } |
29 | |
30 | public void run {
|
31 | say(formatInt(hour, 2) + ":" + formatInt(minute, 2)); |
32 | } |
33 | } |
34 | |
35 | *() {
|
36 | standardAttractors(new Attractor1); |
37 | } |
38 | } |
Began life as a copy of #1022834
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, cfunsshuasjs, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt
No comments. add comment
| Snippet ID: | #1022857 |
| Snippet name: | AI_ClocktimeBot |
| Eternal ID of this version: | #1022857/1 |
| Text MD5: | 761b47237cb2e918488f54605df754ec |
| Author: | stefan |
| Category: | javax / a.i. |
| Type: | JavaX fragment (include) |
| Public (visible to everyone): | Yes |
| Archived (hidden from active list): | No |
| Created/modified: | 2019-04-11 17:23:24 |
| Source code size: | 733 bytes / 38 lines |
| Pitched / IR pitched: | No / No |
| Views / Downloads: | 604 / 1014 |
| Referenced in: | [show references] |